diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index da09c1e61..babcec252 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -1,40 +1,68 @@ -name: Linux/MacOS Build +name: CI on: [push, pull_request] -#env: - jobs: - build: + build_repo: strategy: fail-fast: false matrix: - build_type : [ Release, Debug ] - os : [ macos-latest, ubuntu-20.04 ] - include: - - os: ubuntu-20.04 - cxx: /usr/bin/g++-9 - - os: macos-latest + cfg: + - runs-on: ubuntu-latest + build_type: Release + cxx: g++-9 + cc: gcc-9 + fc: gfortran-9 + args: > + -DENABLE_FORTRAN=ON + + - runs-on: macos-latest + build_type: Release cxx: clang++ + cc: clang + args: > + -DENABLE_FORTRAN=ON + -DCMAKE_Fortran_COMPILER=gfortran-10 + + - runs-on: windows-2022 + build_type: Release + cxx: clang-cl + cc: clang-cl + args: "" + + - runs-on: ubuntu-20.04 + build_type: Debug + cxx: g++-9 + cc: gcc-9 + fc: gfortran-9 + args: > + -DENABLE_FORTRAN=ON - name: "${{ matrix.os }}: ${{ matrix.cxx }} ${{ matrix.build_type }}" - runs-on: ${{ matrix.os }} + - runs-on: macos-latest + build_type: Debug + cxx: clang++ + cc: clang + args: > + -DENABLE_FORTRAN=ON + -DCMAKE_Fortran_COMPILER=gfortran-10 + + name: "Repo • ${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.cxx }} • ${{ matrix.cfg.build_type }} • ${{ matrix.cfg.args }}" + runs-on: ${{ matrix.cfg.runs-on }} env: - CXX : ${{ matrix.cxx }} + CXX : ${{ matrix.cfg.cxx }} + CC : ${{ matrix.cfg.cc }} CCACHE_DIR : ${{github.workspace}}/build/.ccache CCACHE_COMPRESS : true CCACHE_COMPRESSLEVEL : 6 BUILD_CONFIG : > -G Ninja - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -DCMAKE_PREFIX_PATH=/usr/local/Cellar/eigen/3.3.9;/usr/local/opt/bison + -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} -DBUILD_SHARED_LIBS=OFF -DMPIEXEC_PREFLAGS='--bind-to;none;--allow-run-as-root' - -DENABLE_FORTRAN=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/installed - -DWITH_MAX_AM=2;2 - -DERI_MAX_AM_LIST=2,2 - -DERI3_MAX_AM_LIST=3,2 + -DWITH_MAX_AM=3;2 + -DWITH_ERI_MAX_AM=2;2 + -DWITH_ERI3_MAX_AM=3;2 -DENABLE_ERI=1 -DENABLE_ERI3=1 -DENABLE_ONEBODY=1 @@ -62,20 +90,43 @@ jobs: cmake -E make_directory ${{github.workspace}}/test_installed_library cmake -E make_directory ${{github.workspace}}/installed - - name: Install prerequisite MacOS packages - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.os == 'macos-latest' }} + - name: Install MacOS prerequisites + if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'macOS' }} run: | - brew install ninja gcc@10 boost eigen bison ccache - echo "FC=/usr/local/bin/gfortran-10" >> $GITHUB_ENV - echo "EIGEN3_INCLUDE_DIR=/usr/local/include/eigen3" >> $GITHUB_ENV + brew install ninja gcc@10 boost eigen ccache - - name: Install prerequisites Ubuntu packages - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.os == 'ubuntu-20.04' }} + - name: Install Ubuntu prerequisites + if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Linux' }} run: | sudo apt-get update - sudo apt-get install ninja-build g++-9 gfortran-9 liblapack-dev libmpfr-dev libboost-dev libeigen3-dev ccache - echo "FC=/usr/bin/gfortran-9" >> $GITHUB_ENV - echo "EIGEN3_INCLUDE_DIR=/usr/include/eigen3" >> $GITHUB_ENV + sudo apt-get install ninja-build ${{ matrix.cfg.cxx }} ${{ matrix.cfg.fc }} liblapack-dev libmpfr-dev libboost-dev libeigen3-dev ccache + + - name: Install Windows prerequisites, part 1, Create Conda Environment + if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Windows' }} + uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: "" + add-pip-as-python-dependency: true + auto-activate-base: true + conda-build-version: "*" + show-channel-urls: true + + # Note: `shell: bash -l {0}` makes Miniconda created above for Windows available to + # subsequent steps. see https://github.com/conda-incubator/setup-miniconda#usage-examples + + - name: Install Windows prerequisites, part 2, Environment Information + if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Windows' }} + shell: bash -l {0} + run: | + conda info + conda install ninja cmake=3.16 python mpir boost eigen ccache -c conda-forge --yes + conda list + + - name: Prepare compiler environment for Windows + if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Windows' }} + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 - name: Prepare ccache timestamp if: ${{ steps.skip_check.outputs.should_skip != 'true' }} @@ -94,42 +145,209 @@ jobs: restore-keys: | ${{ matrix.config.name }}-ccache- - - name: Generate+build Libint library (ExternalProject) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.build_type == 'Debug'}} - shell: bash + - name: Generate & Build Libint Library (ExternalProject, cplr tests) + if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type != 'Debug'}} + shell: bash -l {0} working-directory: ${{github.workspace}} run: | - cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE $BUILD_CONFIG - cmake --build build - cmake --build build --target check-libint2compiler - cmake --build build --target install - #cd src/bin/test_eri && ./stdtests.pl && cd ../../.. + cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} $BUILD_CONFIG ${{ matrix.cfg.args }} + #cmake --build build --target export # toggle for quick tarball to debug `build_export` + cmake --build build --target library check-libint2compiler install + cd build && echo "ARTIFACT=`ls -1 libint*tgz`" >> $GITHUB_ENV - - name: Generate+build Libint library (FetchContent) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.build_type != 'Debug'}} - shell: bash + - name: Generate & Build Libint Library (FetchContent, full tests) + if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Debug'}} + shell: bash -l {0} working-directory: ${{github.workspace}} run: | - cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLIBINT_BUILD_LIBRARY_AS_SUBPROJECT=ON $BUILD_CONFIG - cmake --build build --target libint-library-export + cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} -DLIBINT_BUILD_LIBRARY_AS_SUBPROJECT=ON $BUILD_CONFIG ${{ matrix.cfg.args }} + cmake --build build --target export cmake --build build --target check-libint2compiler cmake --build build --target check-libint2 cmake --build build --target install - #cd src/bin/test_eri && ./stdtests.pl && cd ../../.. - - name: Test installed Libint library + - name: Archive Library Tarball + if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Release'}} + uses: actions/upload-artifact@v2 + with: + if-no-files-found: error + name: ${{ runner.os }}-${{ matrix.cfg.cxx }} + path: build/${{ env.ARTIFACT }} + retention-days: 1 + + - name: Test Installed Libint Library + #if: false # toggle for quick tarball to debug `build_export` if: ${{ steps.skip_check.outputs.should_skip != 'true' }} - shell: bash + shell: bash -l {0} working-directory: ${{github.workspace}}/test_installed_library run: | cat > CMakeLists.txt < + -DBUILD_SHARED_LIBS=ON + -DLIBINT_LOCAL_Eigen3_INSTALL=ON + -DEigen3_ROOT="/usr/share/miniconda/envs/onlyeigen/" + testargs: > + -DLIBINT_LOCAL_Eigen3_FIND=ON + + - runs-on: macos-latest + libargs: > + -DBUILD_SHARED_LIBS=ON + testargs: "" + + - runs-on: windows-latest + libargs: > + -DBUILD_SHARED_LIBS=OFF + -DCMAKE_CXX_COMPILER=clang-cl + -DCMAKE_C_COMPILER=clang-cl + testargs: > + -DCMAKE_CXX_COMPILER=clang-cl + -DCMAKE_C_COMPILER=clang-cl + + name: "Export • ${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.libargs }}" + runs-on: ${{ matrix.cfg.runs-on }} + + steps: + # Note we're not checking out the repo. All src from Linux tarball generated above. + + - name: Write a Conda Env File + shell: bash -l {0} + run: | + cat > export.yaml <=3.16 + - ninja + - cxx-compiler + - python 3.9 + - boost + - eigen + EOF + if [[ "${{ runner.os }}" == "Windows" ]]; then + sed -i "s/- cxx/#- cxx/g" export.yaml + fi + cat export.yaml + + - name: Create Conda Environment + uses: conda-incubator/setup-miniconda@v2 + with: + mamba-version: "*" + activate-environment: test + channels: conda-forge + environment-file: export.yaml + show-channel-urls: true + + # Step is unnecessary; remove for debugging. + - name: Confound Environment - test bundled Boost + if: ${{ runner.os == 'macOS' }} + shell: bash -l {0} + run: conda remove boost + + # Step is unnecessary; remove for debugging. + - name: Confound Environment - test non-cmake-installed Eigen + if: ${{ runner.os == 'Windows' }} + shell: bash -l {0} + run: rm -rf "${CONDA_PREFIX}/Library/share/eigen3/cmake/" + + # Step is unnecessary; remove step and 3 "*Eigen3*" options in matrix for debugging. + - name: Confound Environment - test handed-off Eigen + if: ${{ runner.os == 'Linux' }} + shell: bash -l {0} + run: | + conda remove eigen + conda create -n onlyeigen eigen -c conda-forge + + - name: Environment Information + shell: bash -l {0} + run: | + conda info + conda list + + - name: Prepare compiler environment for Windows + if: ${{ runner.os == 'Windows' }} + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + + - uses: actions/download-artifact@master + with: + name: Linux-g++-9 + + - name: Extract, Build, Install Libint Library + shell: bash -l {0} + run: | + tar -zxf libint*tgz + mkdir libint && mv libint-2*/* libint/ && cd libint/ + cmake \ + -S. \ + -Bbuild \ + -G"Ninja" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${{github.workspace}}/installed" \ + -DCMAKE_CXX_COMPILER=${CXX} \ + -DCMAKE_PREFIX_PATH="${CONDA_PREFIX}" \ + ${{ matrix.cfg.libargs }} + cmake --build build --target install + + - name: Test Installed Libint library + shell: bash -l {0} + run: | + mkdir test_installed_library && cd test_installed_library + cat > CMakeLists.txt <>> +option_with_default(CMAKE_BUILD_TYPE "Build type (Release or Debug)" Release) + ### compiler-only option_with_default(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT "[EXPERT] Build generated library as a subproject; if FALSE will configure and build separately" OFF) ### library-only option_with_default(REQUIRE_CXX_API "C++11 Libint API: define library targets + test (requires Eigen3; Boost is optional but strongly recommended)" ON) +option_with_default(REQUIRE_CXX_API_COMPILED "Build C++11 Compiled (not just header-only) targets (requires Eigen3; Boost strongly recommended)" ON) option_with_default(ENABLE_FORTRAN "Build Fortran03+ Libint interface (requires Fortran)" OFF) +option_with_print(BUILD_SHARED_LIBS "Build Libint library as shared, not static" OFF) +option_with_print(LIBINT2_BUILD_SHARED_AND_STATIC_LIBS "Build both shared and static Libint libraries in one shot. Uses -fPIC." OFF) + # <<< Which Integrals Classes, Which Derivative Levels >>> option_with_default(ENABLE_ONEBODY "Compile with support for up to N-th derivatives of 1-body integrals (-1 for OFF)" 0) option_with_default(ENABLE_ERI - "Compile with support for up to N-th derivatives of electron repulsion integrals (-1 for OFF)" 0) + "Compile with support for up to N-th derivatives of 4-center electron repulsion integrals (-1 for OFF)" 0) option_with_default(ENABLE_ERI3 "Compile with support for up to N-th derivatives of 3-center electron repulsion integrals (-1 for OFF)" -1) option_with_default(ENABLE_ERI2 @@ -90,13 +99,16 @@ option_with_default(ENABLE_G12DKH option_with_print(DISABLE_ONEBODY_PROPERTY_DERIVS "Disable geometric derivatives of 1-body property integrals (all but overlap, kinetic, elecpot). These derivatives are disabled by default to save compile time. (enable with OFF)" ON) +option_with_print(ENABLE_T1G12_SUPPORT + "Enable Ti,G12 integrals when G12 integrals are enabled. Irrelevant when `ENABLE_G12=OFF`. (disable with OFF)" ON) # <<< Ordering Conventions >>> option_with_default(LIBINT2_SHGAUSS_ORDERING "Ordering for shells of solid harmonic Gaussians: standard -- standard ordering (-l, -l+1 ... l) - gaussian -- the Gaussian ordering (0, 1, -1, 2, -2, ... l, -l)" standard) + gaussian -- the Gaussian ordering (0, 1, -1, 2, -2, ... l, -l) + Consumed at library build-time." standard) option_with_default(LIBINT2_CARTGAUSS_ORDERING "Orderings for shells of cartesian Gaussians: standard -- standard ordering (xxx, xxy, xxz, xyy, xyz, xzz, yyy, ...) @@ -133,51 +145,51 @@ option_with_print(ERI2_PURE_SH option_with_default(WITH_MAX_AM "Support Gaussians of angular momentum up to N. - Can specify values for each derivative levels as a semicolon-separated string" 4) + Can specify values for each derivative level as a semicolon-separated string" 4) option_with_default(WITH_OPT_AM - "Optimize maximally for up to angular momentum N (N <= max-am). (default: (libint_max_am/2)+1)" -1) -message(STATUS "WITH_OPT_AM=${WITH_OPT_AM}") + "Optimize maximally for up to angular momentum N (N <= max-am). + Can specify values for each derivative level as a semicolon-separated string. (default: (libint_max_am/2)+1)" -1) option_with_default(MULTIPOLE_MAX_ORDER "Maximum order of spherical multipole integrals. There is no maximum" 4) option_with_default(WITH_ONEBODY_MAX_AM "Support 1-body ints for Gaussians of angular momentum up to N. - Can specify values for each derivative as a semicolon-separated string. (default: (libint_max_am/2)+1)" -1) + Can specify values for each derivative level as a semicolon-separated string. (default: max_am)" -1) option_with_default(WITH_ONEBODY_OPT_AM "Optimize 1-body ints maximally for up to angular momentum N (N <= max-am). - Can specify values for each derivative levels as a semicolon-separated string" -1) + Can specify values for each derivative level as a semicolon-separated string (default: (max_am/2)+1)" -1) option_with_default(WITH_ERI_MAX_AM - "Support ERIs for Gaussians of angular momentum up to N. - Can specify values for each derivative levels as a semicolon-separated string" -1) + "Support 4-center ERIs for Gaussians of angular momentum up to N. + Can specify values for each derivative level as a semicolon-separated string. (default: max_am)" -1) option_with_default(WITH_ERI_OPT_AM - "Optimize ERIs maximally for up to angular momentum N (N <= max-am). - Can specify values for each derivative levels as a semicolon-separated string (default: (max_am/2)+1)" -1) + "Optimize 4-center ERIs maximally for up to angular momentum N (N <= max-am). + Can specify values for each derivative level as a semicolon-separated string (default: (max_am/2)+1)" -1) option_with_default(WITH_ERI3_MAX_AM "Support 3-center ERIs for Gaussians of angular momentum up to N. - Can specify values for each derivative levels as a semicolon-separated string + Can specify values for each derivative level as a semicolon-separated string. (default: max_am) Set WITH_MAX_AM to mirror this option." -1) option_with_default(WITH_ERI3_OPT_AM "Optimize 3-center ERIs maximally for up to angular momentum N (N <= max-am). - Can specify values for each derivative levels as a semicolon-separated string (default: (max_am/2)+1)" -1) + Can specify values for each derivative level as a semicolon-separated string. (default: (max_am/2)+1)" -1) option_with_default(WITH_ERI2_MAX_AM "Support 2-center ERIs for Gaussians of angular momentum up to N. - Can specify values for each derivative levels as a semicolon-separated string" -1) + Can specify values for each derivative level as a semicolon-separated string. (default: max_am)" -1) option_with_default(WITH_ERI2_OPT_AM "Optimize 2-center ERIs maximally for up to angular momentum N (N <= max-am). - Can specify values for each derivative levels as a semicolon-separated string" -1) + Can specify values for each derivative level as a semicolon-separated string. (default: (max_am/2)+1)" -1) option_with_default(WITH_G12_MAX_AM - "Support integrals for G12 methods of angular momentum up to N." -1) + "Support integrals for G12 methods of angular momentum up to N. (default: max_am)" -1) option_with_default(WITH_G12_OPT_AM - "Optimize G12 integrals for up to angular momentum N (N <= max-am)." -1) + "Optimize G12 integrals for up to angular momentum N (N <= max-am). (default: (max_am/2)+1)" -1) option_with_default(WITH_G12DKH_MAX_AM - "Support integrals for relativistic G12 methods of angular momentum up to N." -1) + "Support integrals for relativistic G12 methods of angular momentum up to N. (default: max_am)" -1) option_with_default(WITH_G12DKH_OPT_AM - "Optimize G12DKH integrals for up to angular momentum N (N <= max-am)." -1) + "Optimize G12DKH integrals for up to angular momentum N (N <= max-am). (default: (max_am/2)+1)" -1) # <<< Miscellaneous >>> @@ -194,24 +206,40 @@ option_with_default(LIBINT_ENABLE_UNROLLING option_with_default(LIBINT_ALIGN_SIZE "(EXPERT) if posix_memalign is available, this will specify alignment of Libint data, in units of sizeof(LIBINT2_REALTYPE). Default is to use built-in heuristics. LAB: LIBINT for bin, LIBINT2 for lib?" 0) +option_with_default(LIBINT2_REALTYPE "Specifies the floating-point data type used by the library. Consumed at library build-time." double) option_with_print(LIBINT_GENERATE_FMA "Generate FMA (fused multiply-add) instructions (to benefit must have FMA-capable hardware and compiler)" OFF) option_with_print(LIBINT_ENABLE_GENERIC_CODE "Use manually-written generic code" OFF) -option_with_flags(ENABLE_XHOST "Enables processor-specific optimization (with MSVC, it enables AVX2 instructions)" ON - "-xHost" "-march=native" "/arch:AVX2") -option_with_default(BUILD_FPIC "Compile lone static library with position independent code (all libraries are fpic when BUILD_SHARED=ON)" OFF) -option_with_default(CMAKE_INSTALL_LIBDIR "Directory to which libraries installed" lib) +option_with_print(ENABLE_XHOST "Enable processor-specific optimization (with MSVC, it enables AVX2 instructions). Consumed at library build-time." ON) +option_with_print(ENABLE_MPFR "Use GNU MPFR library for high-precision testing (EXPERTS ONLY). Consumed at library build-time." OFF) +# next one defined by `include(CTest)` +message(STATUS "Showing option BUILD_TESTING: ${BUILD_TESTING}") + +# <<< Path >>> + +# * only relevant to library +# * use GNUInstallDirs defaults, but define others for CMake and basis files +# * LIBINT2_ dirs are STRING, not PATH, to preserve relative paths + +# next four defined by `include(GNUInstallDirs)` +message(STATUS "Showing option CMAKE_INSTALL_BINDIR: ${CMAKE_INSTALL_BINDIR}") +message(STATUS "Showing option CMAKE_INSTALL_LIBDIR: ${CMAKE_INSTALL_LIBDIR}") +message(STATUS "Showing option CMAKE_INSTALL_INCLUDEDIR: ${CMAKE_INSTALL_INCLUDEDIR}") +message(STATUS "Showing option CMAKE_INSTALL_DATADIR: ${CMAKE_INSTALL_DATADIR}") +set(LIBINT2_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${pnv}" + CACHE STRING "Directory to which CMake files are installed") +message(STATUS "Showing option LIBINT2_INSTALL_CMAKEDIR: ${LIBINT2_INSTALL_CMAKEDIR}") +set(LIBINT2_INSTALL_BASISDIR "${CMAKE_INSTALL_DATADIR}/libint/${LIBINT_VERSION}" + CACHE STRING "Directory to which data files are installed. basis/ directory created within") +message(STATUS "Showing option LIBINT2_INSTALL_BASISDIR: ${LIBINT2_INSTALL_BASISDIR}") -#CONFIGURE --disable-t1g12-support Libint will not support [Ti,G12] integrals #CONFIGURE --enable-accum-ints Accumulate integrals to the buffer, rather than #CONFIGURE copy. #CONFIGURE --enable-flop-counter Support (approximate) FLOP counting by the library. #CONFIGURE CXXGEN must support C++11! #CONFIGURE --enable-profile Turn on profiling instrumentation of the library. #CONFIGURE CXXGEN must support C++11! -#CONFIGURE --enable-mpfr Use MPFR library to test Libint integrals in high -#CONFIGURE precision. #CONFIGURE #CONFIGURE Optional Packages: #CONFIGURE --with-api-prefix Prepend this string to every name in the library API @@ -224,10 +252,6 @@ option_with_default(CMAKE_INSTALL_LIBDIR "Directory to which libraries installed #CONFIGURE libint-. #CONFIGURE --with-pkgconfigdir Specifies the location to put pkg-config's data #CONFIGURE file. Default is $(libdir)/pkgconfig. -#CONFIGURE --with-cmakedir Specifies the location to put FindLibint2.cmake -#CONFIGURE file. Default is $(libdir)/cmake/libint2. -#CONFIGURE --with-real-type Compute all integrals using the given real type LIBINT_USER_DEFINED_REAL -#CONFIGURE (default: double). #CONFIGURE --with-real-type-includes LIBINT_USER_DEFINED_REAL_INCLUDES #CONFIGURE Additional includes necessary to use the real type #CONFIGURE (default: none). @@ -255,7 +279,7 @@ set(LIBINT_HAS_STD_ARRAY 1) set(LIBINT_ARRAY_HAS_FILL 1) find_package(Boost 1.57 REQUIRED) -if (TARGET Boost::boost) # the header-only target +if (TARGET Boost::headers) set(LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS 1) endif() @@ -273,16 +297,12 @@ booleanize01(LIBINT_CONTRACTED_INTS) booleanize01(DISABLE_ONEBODY_PROPERTY_DERIVS) booleanize01(LIBINT_GENERATE_FMA) booleanize01(LIBINT_ENABLE_GENERIC_CODE) +booleanize01(SUPPORT_T1G12) ################################# Main Project ################################# set(EXPORT_STAGE_DIR ${PROJECT_BINARY_DIR}/libint-${LIBINT_EXT_VERSION}) set(STAGED_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/library-install-stage") -if (BUILD_TESTING) - enable_testing() -endif() -include(GNUInstallDirs) - configure_file(cmake/modules/int_computed.cmake.in cmake/modules/int_computed.cmake @ONLY) set(_EXPORT_MODE 0) configure_file(include/libint2/config.h.cmake.in include/libint2/config.h @ONLY) @@ -290,16 +310,10 @@ set(_EXPORT_MODE 1) configure_file(include/libint2/config.h.cmake.in ${EXPORT_STAGE_DIR}/include/libint2/config.h @ONLY) configure_file(include/libint2/config2.h.cmake.in ${EXPORT_STAGE_DIR}/include/libint2/config2.h.cmake.in COPYONLY) -# compiler add_subdirectory(src) -# <<< Test >>> +add_subdirectory(doc) if (BUILD_TESTING) - enable_testing(true) add_subdirectory(tests) endif() - -# <<< Install >>> - -# nothing to install here \ No newline at end of file diff --git a/INSTALL.md b/INSTALL.md index 625a8dcfe..7c42d1618 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,15 +1,596 @@ -# Synopsis +# Libint Compiler vs Library -- configure: `cmake -S /path/to/compiler/source/tree -B build [-Dvar1=value1] [-Dvar2=value2] ...` where - the optional CMake cache variables `var1`, `var2` are described below. Replace `build` with desired path to - the build directory, if desired; it will be created, if needed. -- build: `cmake --build build` -- test (optional): `cmake --build build --target check` -- install the library: `cmake --build build --target install` +Before you read on: -# Build instructions +* If you want a pre-built libint library, packages may be available: + * conda-forge (TBD) + * Debian (TBD) + * Fedora (TBD) +* If you want to know how to _use_ a libint library in your code: + * if you use C++11 or later (strongly recommended): read [this](https://github.com/evaleev/libint/wiki/using-modern-CPlusPlus-API) instead + * if you use pre-2011 C++, C, Fortran, or any other language, refer to the [Libint Programmer's Manual](http://sourceforge.net/projects/libint/files/libint-for-beginners/progman.pdf/download) +* If you want to _build and use_ a libint _library_: + * if all you want is a basic library that computes integrals necessary to compute energies, use the pre-generated library labeled "lmax=6 library (standard ints only)" from the [latest release](https://github.com/evaleev/libint/releases/latest) of Libint + * many codes using libint, e.g. orca and mpqc, already include an appropriately configured libint library, and you do not need to generate it yourself + * if you need compilation directions, _read on_, skipping the compiler/generation parts. +* If you want to know how to _generate_ a libint _library_ using the libint _compiler_, these are some compelling circumstances: + * if you need a custom libint library with choice of integral types, AM, orderings, language interfaces, etc. + * if you want to develop libint with new integral types, recurrence relations, and computation + strategies, you'll need to edit the compiler. If you are interested in working on the compiler + code please consider consulting with one of the Libint authors to avoid duplication of effort. + * if you do need to generate a custom library, _read on_. -For (more) complete instructions please refer to https://github.com/evaleev/libint/wiki -# Appendix +----------------------------------------------------------------------------- + +# Overview + +The Libint build is structured into three parts: + +* generator/compiler + - (1) build src/bin/libint/ into compiler executable `build_libint` + - pretty quick, runs in parallel + - consumes all the enable/max/opt integral options and all orderings options except solid harmonic + - (2) optionally testable +* export + - (3) run `build_libint` to generate library source (C++) files (that upon + compilation can become a Libint2 library) and combine them with other + static source files in src/lib/libint/ and general static files (e.g., + include/ and docs/) into an independent tarball ready for distribution + (with its own CMake configuration, tests, etc.). + - really slow for non-trivial angular momenta, runs in serial + - consumes no options + - build target `export` to stop after this step and collect source tarball +* library + - can be built as a subproject (FetchContent) or completely insulated (bare ExternalProject; default). + For FetchContent, must build libint-library-export target before library build targets appear + - (4) unpack the export tarball and build the library and install into \/library-install-stage/ + - duration depends on number of integrals requested, runs in parallel + - consumes solid harmonic ordering and the CMAKE_INSTALL_[DATA|INCLUDE|LIB]DIR + - the default build target includes this final library build + - (5) optionally testable + - (6) install into CMAKE_INSTALL_PREFIX + + +Command-line synopsis. See [table](#Build-Targets) for `--target` choices (steps refer to numbered bullets above) and [section](#Configuring-Libint) for `-D options` choices. + +```bash +>>> git clone https://github.com/evaleev/libint.git && cd libint +>>> ls +cmake/ COPYING src/ tests/ ... +>>> cmake -S. -Bbuild -GNinja -DCMAKE_INSTALL_PREFIX=/path/to/future/install-libint -D options ... +... +-- Generating done +-- Build files have been written to: /current/dir/build +>>> cmake --build build --target install -j`getconf _NPROCESSORS_ONLN` +``` + +### Build Targets + +| `--target ...` | incl. | steps | ( | see | above | ) | +| -------------- | ----- | ----- | ----- | ----- | ----- | ----- | +| `build_libint` | 1 | - | - | - | - | - | +| `check-libint2compiler` | 1 | 2 | - | - | - | - | +| `export` | 1 | - | 3 | - | - | - | +| `library` (default) | 1 | - | 3 | 4 | - | - | +| `check` | 1 | 2 | 3 | 4 | 5 | - | +| `install` | 1 | - | 3 | 4 | - | 6 | +| `check install` | 1 | 2 | 3 | 4 | 5 | 6 | + +Use combined targets like `cmake --target check install` to avoid some unnecessary rebuilding (esp. of build_libint) that occurs with successive targets. The CMake dependency structure is imperfect. + + +----------------------------------------------------------------------------- + +# Prerequisites + +| Task | Compilers | CMake[^3] | CMake generator[^20] | Py | Boost[^7] | Eigen | GMPXX[^13] | MPFR[^14] | +| :------------------------------------------------------------------- | :---------------------: | :-------: | -------------------- | :-----: | :-------: | :-----: | :--------: | :-------: | +| build target `build_libint` | C++[^1] | 🔵[^4] | Ninja | – | 🔵[^8] | – | 🔵 | – | +| build target `library` | C++[^1], C | 🔵[^5] | Ninja | 🔸[^21] | – | – | – | – | +|   `-D REQUIRE_CXX_API=ON` | C++[^1], C | 🔵[^5] | Ninja | 🔸[^21] | 🔸[^9] | 🔵[^11] | – | – | +|   `-D ENABLE_FORTRAN=ON` | C++[^1], Fortran[^2], C | 🔵[^5] | Ninja | 🔵[^22] | – | – | – | – | +| build project _consuming_ Libint2 library | +|  C interface (I/F), `Libint2::int2` | C++[^1] | 🔸[^6] | Ninja, Makefile | – | – | – | – | – | +|  C++11 header I/F, `Libint2::cxx` | C++[^1] | 🔸[^6] | Ninja, Makefile | – | 🔸[^10] | 🔵 | – | – | +|   `-D ENABLE_MPFR=ON` | C++[^1] | 🔸[^6] | Ninja, Makefile | – | 🔸[^10] | 🔵 | 🔵 | 🔵 | +|  C++11 compiled I/F, `int2-cxx` | C++[^1] | 🔸[^6] | Ninja, Makefile | – | 🔸[^10] | 🔵[^12] | – | – | +|  Fortran I/F, `Libint2::fortran` | Fortran[^2] | 🔸[^6] | Ninja, Makefile | – | | | – | – | + +* `🔵` required +* `🔸` required or recommended, but there's a path forward without +* `—` not involved + +[^1]: C++ compiler that supports C++11 standard. C++11 standard is the fourth most recent international standard for C++, hence most modern compilers support it fully. A common compiler flag is `-std=c++11`, which CMake will impose on the compilation. + +[^2]: Fortran 2003 compiler to enable Fortran bindings generation. + +[^3]: [CMake](https://cmake.org/) 3.16 or higher. + +[^4]: Since Libint2 v2.8 TODO, the GNU toolchain has been replaced by CMake as the sole buildsystem for the Libint2 compiler, `build_libint`. See [update guide](#GNU-Autotools-Update-Guide). + +[^5]: Since Libint2 v2.8 TODO, the CMake buildsystem for the exported library has been reworked. See [update guide](#GNU-Autotools-Update-Guide). + +[^6]: Consuming an installed Libint2 library is simplest with CMake by employing `find_package(Libint2)` and `target_link_libraries(... Libint2::...)` commands. To facilitate consumption outside CMake, pkgconfig files are available for the C interface, and more could be provided. + +[^7]: [Boost](https://www.boost.org/) 1.57 or higher. Only header-only (no compiled libraries) components needed. + +[^8]: Building the Libint2 compiler needs several Boost components including MPL, Type Traits, and Preprocessor. A detectable system installation is required. + +[^9]: Building the Libint2 library with C++11 API needs the Boost Preprocessor (PP) component. For the compiled C++11 interface, `Libint2::int2-cxx`, the PP is actually compiled against, but for the header-only target, `Libint2::cxx`, the PP only sets up the usage dependency. A system installation of Boost is sought, but if none suitable found, a bundled version of PP is installed within the Libint2 header namespace. + +[^10]: Consuming an installed Libint2 library through a C++11 interface requires the Boost Preprocessor (PP) component. Depending on the library *build* environment, a copy may have been bundled/vendored with the install at `CMAKE_INSTALL_PREFIX/CMAKE_INSTALL_INCLUDEDIR/libint2/boost/`. + +[^11]: Building the Libint2 library with C++11 API needs the header-only [Eigen](https://eigen.tuxfamily.org/) library. For the compiled C++11 interface, `Libint2::cxx`, Eigen is actually compiled against, but for the header-only target `Libint2::cxx_ho`, Eigen only sets up the usage dependency. A detectable (either through Eigen3Config.cmake or through location-hinting) system installation is required. + +[^12]: Consuming an installed Libint2 library through the compiled C++11 interface, `Libint2::int2-cxx` requires [Eigen](https://eigen.tuxfamily.org/). It is *strongly* recommended that the same installation of Eigen be used both to build and consume the `Libint2::int2-cxx` target, especially as regards configuring BLAS and other backends. + +[^13]: Building the Libint2 compiler or building the Libint2 library with `-D ENABLE_MPFR=ON` for high-precision testing requires the [GNU Multiple Precision (GMP)](https://gmplib.org/) library. A detectable system installation is required, and it must include C++ support. For Windows, the [MPIR](https://www.mpir.org) project satisfies the requirement. + +[^14]: Building against the Libint2 library for the purpose of high-precision testing with define `LIBINT_HAS_MPFR=1` requires the [MPFR](https://www.mpfr.org/) library. A detectable system installation is required. + +[^20]: Tested CMake generators are [Ninja](https://ninja-build.org/) or [GNU Make](https://www.gnu.org/software/make/). The use of Ninja is **strongly** recommended! + +[^21]: Python used for testing. + +[^22]: Python used to process files for Fortran binding. + + +----------------------------------------------------------------------------- + +# Configuring Libint + +* Notes + * Codes "G", "L", or "C" for each option indicate whether it is consumed by the _g_enerator, the _l_ibrary, the library _c_onsumer, or a combination. + * If your final target is the export tarball, use options that include the letter "G". + * If you're building a library from an export tarball, use options that include the letter "L". + * For a continuous generator->export->library build, options supplied at the top level will be properly handed off to generator and library build. + + +### Which Integrals Classes, Which Derivative Levels + +* `ENABLE_ONEBODY` — G — Compile with support for up to N-th derivatives of 1-body integrals. Use -1 for OFF. [Default=0] +* `ENABLE_ERI` — G — Compile with support for up to N-th derivatives of 4-center electron repulsion integrals. Use -1 for OFF. [Default=0] +* `ENABLE_ERI3` — G — Compile with support for up to N-th derivatives of 3-center electron repulsion integrals. Use -1 for OFF. [Default=-1] +* `ENABLE_ERI2` — G — Compile with support for up to N-th derivatives of 2-center electron repulsion integrals. Use -1 for OFF. [Default=-1] +* `ENABLE_G12` — G — Compile with support for N-th derivatives of MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] +* `ENABLE_G12DKH` — G — Compile with support for N-th derivatives of DKH-MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] + +* `DISABLE_ONEBODY_PROPERTY_DERIVS` — G — Disable geometric derivatives of 1-body property integrals (all but overlap, kinetic, elecpot). + These derivatives are disabled by default to save compile time. Use OFF to enable. [Default=ON] + +* `ENABLE_T1G12_SUPPORT` — G — Enable [Ti,G12] integrals when G12 integrals are enabled. Irrelevant when `ENABLE_G12=OFF`. Use OFF to disable. [Default=ON] + + +### Which Ordering Conventions + +* `LIBINT2_SHGAUSS_ORDERING` — L — Ordering for shells of solid harmonic Gaussians. [Default=standard] + * `standard` — standard ordering (-l, -l+1 ... l) + * `gaussian` — the Gaussian ordering (0, 1, -1, 2, -2, ... l, -l) +* `LIBINT2_CARTGAUSS_ORDERING` — G — Orderings for shells of cartesian Gaussians. [Default=standard] + * `standard` — standard ordering (xxx, xxy, xxz, xyy, xyz, xzz, yyy, ...) This is ordering of the Common Component Architecture (CCA) standard for molecular integral data exchange described in ["Components for Integral Evaluation in Quantum Chemistry", J. P. Kenny, C. L. Janssen, E. F. Valeev, and T. L. Windus, J. Comp. Chem. 29, 562 (2008)](http://dx.doi.org/10.1002/jcc.20815). + * `intv3` — intv3 ordering (yyy, yyz, yzz, zzz, xyy, xyz, xzz, xxy, xxz, xxx) This is used by IntV3, the default integral engine of [MPQC](https://github.com/evaleev/libint/wiki/www.mpqc.org). Use this to make Libint and IntV3 engines in MPQC interoperable. + * `gamess` — [GAMESS](http://www.msg.ameslab.gov/gamess/) ordering (xxx, yyy, zzz, xxy, xxz, yyx, yyz, zzx, zzy, xyz) + * `orca` — [ORCA](http://cec.mpg.de/forum/) ordering (hydrid between GAMESS and standard) + * `bagel` — [BAGEL](https://github.com/evaleev/libint/wiki/nubakery.org) axis-permuted version of intv3 (xxx, xxy, xyy, yyy, xxz, xyz, yyz, xzz, yzz, zzz) +* `LIBINT2_SHELL_SET` — G — Support computation of shell sets sets subject to these restrictions. [Default=standard] + * `standard` — standard ordering: + for (ab|cd): + l(a) >= l(b), + l(c) >= l(d), + l(a)+l(b) <= l(c)+l(d) + for (b|cd): + l(c) >= l(d) + * `orca` — ORCA ordering: + for (ab|cd): + l(a) <= l(b), + l(c) <= l(d), + l(a) < l(c) || (l(a) == l(c) && l(b) < l(d)) + for (b|cd): + l(c) <= l(d) +* `ERI3_PURE_SH` — G — Assume the 'unpaired' center of 3-center ERIs will be transformed to pure solid harmonics. [Default=OFF] +* `ERI2_PURE_SH` — G — Assume the 2-center ERIs will be transformed to pure solid harmonics. [Default=OFF] + + +### How High Angular Momentum + +* Notes + * example for "semicolon-separated string": `-DENABLE_ERI3=2 -DWITH_ERI3_MAX_AM="5;4;3"`. cmake configuration prints: + + ``` + -- Setting option ENABLE_ERI3: 2 + -- Setting option WITH_ERI3_MAX_AM: 5;4;3 + ``` + + * high MAX_AM generating >20k files may require `ulimit -s 65535` for linking library target on Linux to avert "ld: Argument list too long". Unity build likely averts this. + +* `WITH_MAX_AM` — G — Support Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. Specify values greater or equal to `WITH__MAX_AM`; often mirrors `WITH_ERI3_MAX_AM`. [Default=4] +* `WITH_OPT_AM` — G — Optimize maximally for up to angular momentum N (N <= WITH_MAX_AM). Can specify values for each derivative level as a semicolon-separated string. [Default=-1 -> `(WITH_MAX_AM/2)+1`] + +* `MULTIPOLE_MAX_ORDER` — G — Maximum order of spherical multipole integrals. There is no maximum. [Default=4] + +* `WITH_ONEBODY_MAX_AM` — G — Support 1-body ints for Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. [Default=-1 -> `WITH_MAX_AM`] +* `WITH_ONEBODY_OPT_AM` — G — Optimize 1-body ints maximally for up to angular momentum N (N <= max-am). Can specify values for each derivative level as a semicolon-separated string. [Default=-1 -> `WITH_OPT_AM`] + +* `WITH_ERI_MAX_AM` — G — Support 4-center ERIs for Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. [Default=-1 -> `WITH_MAX_AM`] +* `WITH_ERI_OPT_AM` — G — Optimize 4-center ERIs maximally for up to angular momentum N (N <= max-am). Can specify values for each derivative level as a semicolon-separated string. [Default=-1 -> `WITH_OPT_AM`] + +* `WITH_ERI3_MAX_AM` — G — Support 3-center ERIs for Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. [Default=-1 -> `WITH_MAX_AM`] +* `WITH_ERI3_OPT_AM` — G — Optimize 3-center ERIs maximally for up to angular momentum N (N <= max-am). Can specify values for each derivative level as a semicolon-separated string. [Default=-1 -> `WITH_OPT_AM`] + +* `WITH_ERI2_MAX_AM` — G — Support 2-center ERIs for Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. [Default=-1 -> `WITH_MAX_AM`] +* `WITH_ERI2_OPT_AM` — G — Optimize 2-center ERIs maximally for up to angular momentum N (N <= max-am). Can specify values for each derivative level as a semicolon-separated string. [Default=-1 -> `WITH_OPT_AM`] + +* `WITH_G12_MAX_AM` — G — Support integrals for G12 methods of angular momentum up to N. No specification with per-derivative list. [Default=-1 -> `WITH_MAX_AM`] +* `WITH_G12_OPT_AM` — G — Optimize G12 integrals for up to angular momentum N (N <= max-am). No specification with per-derivative list. [Default=-1 `WITH_OPT_AM`] + +* `WITH_G12DKH_MAX_AM` — G — Support integrals for relativistic G12 methods of angular momentum up to N. No specification with per-derivative list. [Default=-1 -> `WITH_MAX_AM`] +* `WITH_G12DKH_OPT_AM` — G — Optimize G12DKH integrals for up to angular momentum N (N <= max-am). No specification with per-derivative list. [Default=-1 `WITH_OPT_AM`] + + +### Compilers and Flags + +* `CMAKE_CXX_COMPILER` — G L — Specify C++ Compiler. [Standard CMake variable](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html) +* `CMAKE_C_COMPILER` — G L — Specify C Compiler. [Standard CMake variable](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html) +* `CMAKE_Fortran_COMPILER` — G L — Specify Fortran Compiler. [Standard CMake variable](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html) +* `CMAKE_CXX_FLAGS` — G L — Additional C++ flags. [Standard CMake variable](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html) +* `CMAKE_C_FLAGS` — G L — Additional C flags. [Standard CMake variable](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html) +* `CMAKE_Fortran_FLAGS` — G L — Additional Fortran flags. [Standard CMake variable](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html) + + +### Install Paths + +* Notes + * Approximate defaults are shown. Actual defaults from [GNUInstallDirs](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html) + +* `CMAKE_INSTALL_PREFIX` — L — Directory into which library installed. [Standard CMake variable](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html) +* `CMAKE_INSTALL_BINDIR` — L — Directory within `CMAKE_INSTALL_PREFIX` to which executables and runtime libraries are installed. [Standard CMake variable](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html) [Default=bin] +* `CMAKE_INSTALL_LIBDIR` — L — Directory within `CMAKE_INSTALL_PREFIX` to which libraries are installed. [Standard CMake variable](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html) [Default=lib] +* `CMAKE_INSTALL_INCLUDEDIR` — L — Directory within `CMAKE_INSTALL_PREFIX` to which headers are installed. [Standard CMake variable](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html) [Default=include] +* `CMAKE_INSTALL_DATADIR` — L — Directory within `CMAKE_INSTALL_PREFIX` to which data files are installed. [Standard CMake variable](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html) [Default=share] +* `LIBINT2_INSTALL_CMAKEDIR` — L — Directory within `CMAKE_INSTALL_PREFIX` to which CMake files are installed. [Default=lib/cmake/libint2] +* `LIBINT2_INSTALL_BASISDIR` — L — Directory within `CMAKE_INSTALL_PREFIX` to which data (basis) files are installed. basis/ directory created within this. [Default=share/libint/] +* `LIBINT2_INSTALL_FMODDIR` — L — Directory within `CMAKE_INSTALL_PREFIX` to which Fortran module files are installed if `ENABLE_FORTRAN=ON`. [Default=include/libint2/fortran2/modules] + + +### Detecting Dependencies + +* `Python_EXECUTABLE` — L — Path to Python interpreter. +* `CMAKE_PREFIX_PATH` — G L — Set to list of root directories to look for external dependencies. [Standard CMake variable](https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html) +* `BOOST_ROOT` — G L C — +* `Multiprecision_ROOT` — G L — +* `Eigen3_ROOT` — L C — Prefix to installation location (`Eigen3_ROOT/...` exists) +* `Libint2_DIR` — C — CMake variable, set to directory containing this Config file +* `LIBINT_LOCAL_Eigen3_FIND` — C — Set to `ON` before `find_package(Libint2)` to load the Eigen3 target exported by `LIBINT_LOCAL_Eigen3_INSTALL=ON` if Libint library built locally. [Default=OFF] + +EIGEN3_INCLUDE_DIR? + +* Hint dependency locations all at the same installation prefix: + + ``` + -D CMAKE_PREFIX_PATH="/path/to/installation/prefix" + -D CMAKE_PREFIX_PATH="/home/miniconda/envs/l2dev" + ``` + +* Hint dependency locations all at different installation prefixes: + + ``` + -D CMAKE_PREFIX_PATH="/home/miniconda/envs/onlyboost;/home/miniconda/envs/onlygmp;/home/miniconda/envs/onlyeigen" + ``` + +* Hint dependency locations targeted by package: + + ``` + -D BOOST_ROOT="/home/miniconda/envs/onlyboost" + -D Multiprecision_ROOT="/home/miniconda/envs/onlygmp" + -D Eigen3_ROOT="/home/miniconda/envs/onlyeigen" + ``` + +* Hint dependency locations targeted by Config.cmake (most CMake-like): + + ``` + -D Eigen3_DIR="/home/miniconda/envs/onlyeigen/share/eigen3/cmake" + -D Boost_DIR="/home/miniconda/envs/onlyboost/lib/cmake/Boost-1.73.0" + ``` + +* Hint dependency locations targeted by package variables (least CMake-like): UNTESTED + + ``` + ``` + + +### Build Library What + +* `REQUIRE_CXX_API` — L — Build C++11 Libint API. Define header-only library target and check target (requires Eigen3; Boost recommended). [Default=ON] +* `REQUIRE_CXX_API_COMPILED` — L — Build C++11 Libint API. Define compiled (not just header-only) targets (requires Eigen3; Boost recommended). [Default=ON] +* `ENABLE_FORTRAN` — L — Build Fortran03+ module/bindings (requires C and Fortran compilers and Python). [Default=OFF] +* `ENABLE_MPFR` — L — Use MPFR library to test Libint integrals in high precision (requires MPFR; experts only). [Default=OFF] +* `LIBINT_LOCAL_Eigen3_INSTALL` — L — Install an exported target with hard-coded Eigen3 dependency paths. This is potentially useful and important when consuming the compiled C++11 interface library so that the Libint library build and Libint consumer build use the same Eigen3 installation & ABI. This is at most a convenience when consuming the header-only C++11 interface library. See `LIBINT_LOCAL_Eigen3_FIND`. [Default=OFF] + + +### Build Library How + +* `CMAKE_BUILD_TYPE` — G L — [Standard CMake variable](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html) [Default=Release] +* `BUILD_SHARED_LIBS` — L — Build Libint library as shared, not static. [Standard CMake variable](https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html) [Default=OFF] +* `LIBINT2_BUILD_SHARED_AND_STATIC_LIBS` — L — Build both shared and static Libint libraries in one shot. Uses `-fPIC`. [Default=OFF] +* `ENABLE_XHOST` — L — Enables processor-specific optimization (with MSVC, it enables AVX2 instructions) [Default=ON] +* `BUILD_TESTING` — G L — Whether to build the testing infrastructure and define the `check` target. [Standard CMake variable](https://cmake.org/cmake/help/latest/command/enable_testing.html) [Default=ON] +* `LIBINT_BUILD_LIBRARY_AS_SUBPROJECT` — G — If building compiler and library in continuous command, build generated library as a subproject; if OFF will configure and build separately (expert only). [Default=OFF] + + +### Miscellaneous + +* `LIBINT2_REALTYPE` — L — Specifies the floating-point data type used by the library. [Default=double] + By overriding the default it is possible to customize the library to use a lower-precision representation (which typically results in a performance boost) and/or to generate [SIMD](http://en.wikipedia.org/wiki/SIMD) vectorized code. *N.B. C++11 interface cannot be currently used with SIMD vectorized libraries!* The following values are valid: + * `double` -- double-precision floating-point representation of a real number; + * `float` -- single-precision floating-point number; + * `libint2::simd::VectorAVXDouble` -- vector of 4 packed doubles that can be used with [AVX](http://en.wikipedia.org/wiki/Advanced_Vector_Extensions) instructions available on reasonably-modern x86 hardware (starting with Intel Sandy Bridge and AMD Bulldozer microarchitectures, available in processors since 2011); + * `libint2::simd::VectorSSEDouble` -- vector of 2 packed doubles that can be used with [SSE2](http://en.wikipedia.org/wiki/SSE2) instructions available on all x86 platforms, including those released before 2011; + * `libint2::simd::VectorSSEFloat` -- vector of 4 packed floats that can be used with [SSE](http://en.wikipedia.org/wiki/Streaming_SIMD_Extensions) instructions available on all x86 platforms, including those released before 2011; + * `libint2::simd::VectorQPXDouble` -- vector of 4 packed doubles that can be used with QPX instructions available on recent PowerPC hardware (IBM Blue Gene/Q); + * `libint2::simd::VectorFP2Double` -- vector of 2 packed doubles that can be used with FP2 (Double Hummer) instructions available on older PowerPC hardware (IBM Blue Gene/P). + + With the exception of `float`, these are vector types implemented in Libint using compiler _intrinsics_, functions that translate directly into vector instructions. To use these vector types you may need to provide additional compiler flags that will enable support for vector instructions. For example, to enable support for AVX in Clang use the `-mavx` compiler flag. With Intel compiler use flag `-xHOST` to enable all vector instruction sets supported by the processor on which you are compiling. + + **N.B.** It is also possible to use real vector types of [Agner Fog's vectorclass library](http://www.agner.org/optimize/#vectorclass), e.g. `Vec4d` and `Vec8f` for AVX. To use this library you need to add this to CPPFLAGS or CXXFLAGS: `-Ipath_to_vectorclass -DLIBINT2_HAVE_AGNER_VECTORCLASS` . On macOS, we only succeeded in using this library with a recent GNU C++ compiler, not with Clang. Not tested after CMake rework. + +* `LIBINT_CONTRACTED_INTS` — G — Turn on support for contracted integrals. [Default=ON] +* `LIBINT_ERI_STRATEGY` — G — Compute ERIs using the following strategy (experts only). [Default=1] +* `LIBINT_USE_COMPOSITE_EVALUATORS` — G — Libint will use composite evaluators (i.e. every evaluator will compute one integral type only). [Default=ON] +* `LIBINT_SINGLE_EVALTYPE` — G — Generate single evaluator type (i.e. all tasks use the same evaluator). [Default=ON] +* `LIBINT_ENABLE_UNROLLING` — G — Unroll shell sets into integrals (will unroll shell sets larger than N) (no->0, yes->1000000000). [Default=100] +* `LIBINT_ALIGN_SIZE` — G — If posix_memalign is available, this will specify alignment of Libint data, in units of sizeof(LIBINT2_REALTYPE). Default is to use built-in heuristics (experts only). [Default=0] +* `LIBINT_GENERATE_FMA` — G — Generate FMA (fused multiply-add) instructions (to benefit must have FMA-capable hardware and compiler). [Default=OFF] +* `LIBINT_ENABLE_GENERIC_CODE` — G — Use manually-written generic code. [Default=OFF] + + +----------------------------------------------------------------------------- + +# GNU Autotools Update Guide + +* Notes + * When three option names present, they are for libtool+cmake --> cmake+cmake (c. #148 for Psi4 c. 2020-2021) --> cmake+cmake + +* `--enable-1body=N` --> `-D ENABLE_ONEBODY` +* `--enable-eri=N` --> `-D ENABLE_ERI=N` +* `--disable-eri` --> `-D ENABLE_ERI=-1` +* `--enable-eri3=N` --> `-D ENABLE_ERI3=N` +* `--enable-eri2=N` --> `-D ENABLE_ERI2=N` + +* `--with-shgauss-ordering=label` --> `-D LIBINT2_SHGAUSS_ORDERING=label` +* `--with-cartgauss-ordering=label` --> `-D LIBINT2_CARTGAUSS_ORDERING=label` +* `--with-shell-set=label` --> `-D LIBINT2_SHELL_SET=label` +* `--enable-eri3-pure-sh` --> `-D ERI3_PURE_SH=ON` +* `--enable-eri2-pure-sh` --> `-D ERI2_PURE_SH=ON` + +* `--with-max-am=N` --> `-D WITH_MAX_AM=N` +* `--with-max-am=N0,N1,N2` --> `-D WITH_MAX_AM="N0;N1;N2"` (notice semicolons and quotes. This is standard CMake list syntax) +* `--with-opt-am=N` --> `-D WITH_OPT_AM=N` +* `--with-opt-am=N0,N1,N2` --> `-D WITH_OPT_AM="N0;N1;N2"` + +* `--with-multipole-max-order=N` --> `-D MULTIPOLE_MAX_ORDER=N` + +* `--with-1body-max-am=N` --> `-D WITH_ONEBODY_MAX_AM=N` +* `--with-1body-max-am=N0,N1,N2` --> `-D WITH_ONEBODY_MAX_AM="N0;N1;N2"` +* `--with-1body-opt-am=N` --> `-D WITH_ONEBODY_OPT_AM=N` +* `--with-1body-opt-am=N0,N1,N2` --> `-D WITH_ONEBODY_OPT_AM="N0;N1;N2"` + +* `--with-eri-max-am=N` --> `-D WITH_ERI_MAX_AM=N` +* `--with-eri-max-am=N0,N1,N2` --> `-D WITH_ERI_MAX_AM="N0;N1;N2"` +* `--with-eri-opt-am=N` --> `-D WITH_ERI_OPT_AM=N` +* `--with-eri-opt-am=N0,N1,N2` --> `-D WITH_ERI_OPT_AM="N0;N1;N2"` + +* `--with-eri3-max-am=N` --> `-D WITH_ERI3_MAX_AM=N` +* `--with-eri3-max-am=N0,N1,N2` --> `-D WITH_ERI3_MAX_AM="N0;N1;N2"` +* `--with-eri3-opt-am=N` --> `-D WITH_ERI3_OPT_AM=N` +* `--with-eri3-opt-am=N0,N1,N2` --> `-D WITH_ERI3_OPT_AM="N0;N1;N2"` + +* `--with-eri2-max-am=N` --> `-D WITH_ERI2_MAX_AM=N` +* `--with-eri2-max-am=N0,N1,N2` --> `-D WITH_ERI2_MAX_AM="N0;N1;N2"` +* `--with-eri2-opt-am=N` --> `-D WITH_ERI2_OPT_AM=N` +* `--with-eri2-opt-am=N0,N1,N2` --> `-D WITH_ERI2_OPT_AM="N0;N1;N2"` + +* `--enable-g12=N` --> `-D ENABLE_G12=N` +* `--enable-g12dkh=N` --> `-D ENABLE_G12DKH` +* `--disable-t1g12-support` --> `-D ENABLE_T1G12_SUPPORT=OFF` +* `--with-g12-max-am=N` --> `-D WITH_G12_MAX_AM=N` +* `--with-g12-opt-am=N` --> `-D WITH_G12_OPT_AM=N` +* `--with-g12dkh-max-am=N` --> `-D WITH_G12DKH_MAX_AM=N` +* `--with-g12dkh-opt-am=N` --> `-D WITH_G12DKH_OPT_AM=N` + +* `--disable-1body-property-derivs` --> `-D DISABLE_ONEBODY_PROPERTY_DERIVS=ON` + +* `--enable-shared` --> `-D BUILD_SHARED=ON` --> `-D BUILD_SHARED_LIBS=ON` (standard CMake variable) +* `--enable-static` --> `-D BUILD_STATIC=ON` --> `-D BUILD_SHARED_LIBS=OFF` (standard CMake variable) +* `--enable-shared --enable-static` --> `-D BUILD_SHARED=ON -D BUILD_STATIC=ON` --> `-D LIBINT2_BUILD_SHARED_AND_STATIC_LIBS=ON` + +* `-D REQUIRE_CXX_API=ON` --> `-D ENABLE_CXX11API=ON` --> `-D REQUIRE_CXX_API=ON` +* `--enable-mpfr` --> assumed present --> `-D ENABLE_MPFR=ON` +* `--prefix=path` --> `-D CMAKE_INSTALL_PREFIX=path` (standard CMake variable) +* `--with-cmakedir=partialpath` --> `-D LIBINT2_INSTALL_CMAKEDIR=partialpath` +* `--with-real-type=type` --> `-D LIBINT2_REALTYPE=type` + +* (target) `libint2` --> `Libint2::int2` +* (target) `libint2_cxx` --> `Libint2::cxx` + +* `ENV(CXX)=/path/to/c++/compiler` --> `-D CMAKE_CXX_COMPILER=/path/to/c++/compiler` +* `ENV(CXXFLAGS)` --> `-D CMAKE_CXX_FLAGS` +* `ENV(CPPFLAGS)=-I/path/to/boost/includes` --> -D BOOST_ROOT=/path/to/boost/prefix` +* `ENV(FC)=/path/to/fortran/compiler` --> `-D CMAKE_Fortran_COMPILER=/path/to/fortran/compiler` + + +----------------------------------------------------------------------------- + +# Consuming Libint + +### Programming to Access Integrals + +* if you use C++11 or later (strongly recommended): read [this](https://github.com/evaleev/libint/wiki/using-modern-CPlusPlus-API) instead +* if you use pre-2011 C++, C, Fortran, or any other language, refer to the [Libint Programmer's Manual](http://sourceforge.net/projects/libint/files/libint-for-beginners/progman.pdf/download) for brief information on how to use the library in your code. + +### Consumption Targets + +| Namespaced Target[^15] | Component[^16] | Built by Default | Ensure Built | Ensure Excluded | Internal Target(s)[^17] | Alias[^18] | +| ---------------------- | -------------- | ---------------- | ----------------------------- | ----------------------------------------- | ----------------------------------- | ------------ | +| `Libint2::int2` | `C` | yes | always | impossible | `int-{static,shared}` | `libint2` | +| `Libint2::cxx` | `CXX_ho` | yes | `REQUIRE_CXX_API=ON` | `REQUIRE_CXX_API=OFF` and withhold Eigen3 | `int-cxx-headeronly-{static,shared}` | `libint2_cxx` | +| `Libint2::int2-cxx` | `CXX` | yes | `REQUIRE_CXX_API_COMPILED=ON` | `REQUIRE_CXX_API_COMPILED=OFF` | `int-cxx-compiled-{static,shared}` | +| Fortran local[^19] | (NYI) | no | `ENABLE_FORTRAN=ON` | `ENABLE_FORTRAN=OFF` | `libint_f` | + +[^15]: Targets for library consumer use. These are available after `find_package(Libint2)` or `add_subdirectory()`. +[^16]: Ensure target found in installation after `find_package(Libint2 COMPONENTS ...)`. +[^17]: Targets in src/lib/libint/CMakeLists.txt.export . Names subject to change. Use namespaced target names in any consuming code. +[^18]: Deprecated legacy aliases. Update any uses to namespaced target. +[^19]: The `libint_f` internal target defines the Fortran interface to Libint2. One must also link to `Libint2::int2` or `Libint2::cxx`. At present, it is not exported, and a namespaced target is not defined. + + +----------------------------------------------------------------------------- + +## Packagers + +* Decide if you want the Boost preprocessor headers bundled with Libint or if they should be a + build-against-time dependency of the C++11 interface. Withhold (bundle) or supply (dependency) + Boost detection paths from the library build accordingly. FWIW, Conda bundles. +* Decide if you want the compiled cxx library. something like it is in use in mpqc4 + + +----------------------------------------------------------------------------- + +# Platform-Specific Notes + +### Linux + +### macOS + +* Apple `clang++` and [MacPorts](http://www.macports.org/) `g++` (4.8) both work with `-std=c++11` flag +* MacPorts gmp package works fine +* On macOS the default `ar` program lacks support for response files (e.g., https://github.com/evaleev/libint/issues/135 and see https://gitlab.kitware.com/cmake/cmake/issues/16731). Thus you should install the GNU `ar` program (e.g., using HomeBrew: `brew install binutils`) and tell CMake to use it (e.g., add `-DCMAKE_AR=/usr/local/opt/binutils/bin/ar` to the CMake command line). + +### Windows + +* Several blocking or correctness issues exist; the most thorough list is at .github/workflows/cmake.yml +* A production path is to generate an export tarball with Linux, build static library on Windows, and consume +* Use MPIR package for GMP + + +----------------------------------------------------------------------------- + +# Program-Specific Notes + +### mpqc4 + +* standard libtool configuration: + + ``` + --enable-generic-code --with-max-am=6 --with-opt-am=3 --enable-eri3=0 --enable-eri2=0 --enable-eri3-pure-sh --enable-eri2-pure-sh --enable-fma --disable-1body-property-derivs + ``` + +* libtool configuration prior to Jan. 8, 2015: + + ``` + --enable-eri=0 --with-max-am=7 --with-opt-am=4 --disable-unrolling --enable-generic-code --enable-contracted-ints + ``` + +### gamess + +* standard libtool configuration: + + ``` + --enable-eri=0 --with-max-am=7 --with-opt-am=4 --disable-unrolling --enable-generic-code --enable-contracted-ints --with-cartgauss-ordering=gamess + ``` + +### orca + +* a libint library (version 2.0.2) is embedded in ORCA +* standard libtool configuration: + + ``` + --enable-eri=2 --enable-eri3=2 --enable-eri2=2 --with-max-am=7 --with-opt-am=4 --with-eri-max-am=7,4,3 --with-eri-opt-am=4,3,2 --disable-unrolling --enable-generic-code --enable-contracted-ints --with-cartgauss-ordering=orca --with-shell-set=orca --enable-eri3-pure-sh --enable-eri2-pure-sh + ``` + +### bagel + +* standard libtool configuration: + + ``` + --with-max-am=4 --with-eri3-max-am=6 --with-eri2-max-am=6 --enable-eri3=1 -enable-eri=1 --enable-eri2=1 --disable-unrolling --enable-generic-code --enable-contracted-ints --with-cartgauss-ordering=bagel + + ``` + +* if you want to use spherical Gaussians only add: `--enable-eri3-pure-sh --enable-eri2-pure-sh` (some tests may fail) +* It appears that on a Mac Libint and BAGEL must be either both static or both shared (2/3/2014) + +### psi4 + +* production CMake configuration: + + ``` + -D REQUIRE_CXX_API=ON + -D LIBINT2_SHGAUSS_ORDERING=gaussian + -D LIBINT2_CARTGAUSS_ORDERING=standard + -D LIBINT2_SHELL_SET=standard + -D ERI3_PURE_SH=OFF + -D ERI2_PURE_SH=OFF + -D ENABLE_ERI=2 + -D ENABLE_ERI3=2 + -D ENABLE_ERI2=2 + -D ENABLE_ONEBODY=2 + -D MULTIPOLE_MAX_ORDER=4 + -D WITH_MAX_AM="6;5;4" + -D WITH_ERI_MAX_AM="5;4;3" + -D WITH_ERI3_MAX_AM="6;5;4" + -D WITH_ERI2_MAX_AM="6;5;4" + ``` + +* minimal detection: + + ``` + find_package( + Libint2 + COMPONENTS + CXX_ho + gss + impure_sh + eri_c4_d0_l3 eri_c3_d0_l4 eri_c2_d0_l4 onebody_d0_l4 + eri_c4_d1_l2 eri_c3_d1_l3 eri_c2_d1_l3 onebody_d1_l3 + eri_c4_d2_l2 eri_c3_d2_l3 eri_c2_d2_l3 onebody_d2_l3 + ) + ``` + +* see [notes](https://github.com/psi4/psi4/blob/master/external/upstream/libint2/CMakeLists.txt) for details of Psi4/Libint2 configuration + +* Psi4 near-future configuration additions: + + ``` + -DDISABLE_ONEBODY_PROPERTY_DERIVS=OFF + -DENABLE_G12=1 + -DWITH_G12_MAX_AM=4 + -DWITH_G12_OPT_AM=3 + ``` + + +----------------------------------------------------------------------------- + +# Miscellaneous Questions + +#### Where do I get the source code? + +The only way to get the compiler source is from the [Libint source code repository](https://github.com/evaleev/libint)on [GitHub](github.com). You can use a client, like GitHub app or (our favorite) [SourceTree](http://www.sourcetreeapp.com) app from Atlassian. Or from the command line: `git clone https://github.com/evaleev/libint.git` + +#### What happened to autoconf? + +Version 2.5.0 and older of the exported libint library was buildable using GNU Autoconf and [GNU Make](https://www.gnu.org/software/make/). *As of version 2.6.0 the Autoconf build is deprecated*; the exported libint library should be configured with [CMake](https://cmake.org/) and built with [any CMake-supported generator](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html), e.g. Ninja and GNU Make. + +Version 2.7 and older of the compiler repo was buildable using GNU Autoconf. *As of version 2.8, the Autoconf build is deprecated*; use CMake instead. TODO 2.8 + +#### What is the status and importance of SIMD vectorization in Libint? + +SIMD vectorization is the crucial contributor to performance of a modern processor core. Libint code can typically hit up to 70% of FLOP peak on a scalar core, hence on a SIMD core divide that number by the vector length (4 for AVX in double precision). The situation is only going to get worse (accelerators already use 8- and 16-wide vector units, and future mainstream processors are likely to use 8-wide units also). Hence if your method spends significant portion of its time computing integrals start rewriting your code now. + +Vectorization of Libint is work in progress. However, by switching to AVX we see a factor of 2-2.5 speedup of the integrals kernels compared to scalar performance, thus we are optimistic that it will be possible to attain 50% of peak on AVX hardware. It is clear that significant reorganization of the manner in which integrals are computed and digested is involved, but these costs are unavoidable. + +#### What compiler is best? + +To obtain peak performance it is *very important* to use the C++ compiler and compiler options that are appropriate for the given platform. It is impossible to provide specific recommendations for specific platforms. The `ENABLE_XHOST` option does allow the compiler to optimize for current architecture. We recommend to use a vendor compiler (e.g., Intel) before trying clang++ and g++. In some situations, however, clang++ and g++ are known to outperform the x86 vendor compiler, so we recommend trying several compilers. + diff --git a/LICENSE b/LICENSE index e3c433c92..d77f37a9e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ Libint - a library for the evaluation of molecular integrals of many-body operators over Gaussian functions -Copyright (C) 2004-2020 Edward F. Valeev +Copyright (C) 2004-2021 Edward F. Valeev Libint is free software. Most of the source code of the Libint compiler (code generator) can be redistributed and/or modified under the terms of the GNU General Public License, version 3, diff --git a/README.md b/README.md index 472d83563..1dbf1f3a9 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ -Libint - a library for the evaluation of molecular integrals of many-body operators over Gaussian functions +# Libint -- master status: [![Build Status](https://travis-ci.org/evaleev/libint.svg?branch=master)](https://travis-ci.org/evaleev/libint) +a library for the evaluation of molecular integrals of many-body operators over Gaussian functions + +- master status: ![Build Status](https://github.com/evaleev/libint/actions/workflows/cmake/badge.svg) - project page: http://libint.valeyev.net/ - e-mail - libint@valeyev.net -See [the wiki](https://github.com/evaleev/libint/wiki) for the installation and usage instructions. +See [the INSTALL.md file](INSTALL.md) for installation instructions and links to usage instructions. -Copyright (C) 2004-2021 Edward F. Valeev +Copyright (C) 2004-2022 Edward F. Valeev diff --git a/include/libint2/config.h.in b/archive_libtool/config.h.in similarity index 100% rename from include/libint2/config.h.in rename to archive_libtool/config.h.in diff --git a/configure.ac b/archive_libtool/configure.ac similarity index 100% rename from configure.ac rename to archive_libtool/configure.ac diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index 96b69e89e..ff419a6f2 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -1,5 +1,5 @@ # libint2-config.cmake -# ------------------- +# -------------------- # # Libint2 cmake module. # This module sets the following variables in your project: @@ -8,10 +8,7 @@ # # Libint2_FOUND - true if Libint2 and all required components found on the system # Libint2_VERSION - Libint2 version in format Major.Minor.Release -# Libint2_INCLUDE_DIRS - Directories where Libint2 and libderiv headers are located. -# Libint2_INCLUDE_DIR - same as DIRS -# Libint2_LIBRARIES - Libint2 and libderiv libraries to link against. -# Libint2_LIBRARY - same as LIBRARIES +# Libint2_EXT_VERSION - Libint2 version including the (optional) buildid, such as beta.3 # Libint2_MAX_AM_ERI - maximum angular momentum level of Libint2 libraries # # @@ -22,32 +19,59 @@ # shared - search for only shared library # static - search for only static library # -# onebody_dD_lL - search for library including 1-body integrals with derivative order D (D=0..4) and max angular momentum up to L (L=2..10) -# eri_cC_dD_lL - search for library including 2-body integrals with C centers, derivative order D (D=0..4), and max angular momentum up to L (L=2..10) +# onebody_dD_lL - search for library including 1-body integrals with derivative order D (D=0..4) and max angular momentum up to L (L=2..10) +# eri_cC_dD_lL - search for library including 2-body integrals with C (C=2,3,4) centers, derivative order D (D=0..4), and max angular momentum up to L (L=2..10) +# g12_dD-lL - search for library including F12 integrals with Gaussian factors with derivative order D and max angular momentum up to L +# g12dkh_dD-lL - search for library including F12 integrals with Gaussian factors and DKH with derivative order D and max angular momentum up to L (NYI) # -# cart shell_set used_by -# -------- --------- ------- -# ss - search for standard + standard = mpqc4, psi4 -# so - search for + orca -# is - search for intv3 + standard = mpqc3 -# io - search for + orca -# gs - search for gamess + standard = gamess -# go - search for + orca -# os - search for orca + standard -# oo - search for + orca = orca -# bs - search for bagel + standard = bagel -# bo - search for + orca +# impure_sh - search for library that doesn't assume 2- and 3-center integrals involve pure solid harmonics +# +# sph cart shell_set used_by +# -------- -------- --------- ------- +# sss - search for standard + standard + standard = mpqc4 +# sso - search for + orca +# sis - search for + intv3 + standard = mpqc3 +# sio - search for + orca +# sgs - search for + gamess + standard = gamess +# sgo - search for + orca +# sos - search for + orca + standard +# soo - search for + orca = orca +# sbs - search for + bagel + standard = bagel +# sbo - search for + orca +# gss - search for gaussian + standard + standard = psi4 (v1.4, v1.5) +# gso - search for + orca +# gis - search for + intv3 + standard +# gio - search for + orca +# ggs - search for + gamess + standard +# ggo - search for + orca +# gos - search for + orca + standard +# goo - search for + orca +# gbs - search for + bagel + standard +# gbo - search for + orca +# +# C - search for at least Libint2::int2 target +# CXX_ho - search for at least Libint2::cxx target +# CXX - search for at least Libint2::int2-cxx target +# Fortran - search for at least libint_f target (NYI) # # # Exported targets: # # :: # -# If Libint2 is found, this module defines the following :prop_tgt:`IMPORTED` -# targets. :: +# If Libint2 is found and no language components are requested, this module +# defines at least the following :prop_tgt:`IMPORTED` target. :: +# +# Libint2::int2 - library with C API +# +# If Libint2 is found, depending on components requested, available +# dependencies, and fullness of the installation, this module defines up to the +# following :prop_tgt:`IMPORTED` targets. :: # -## Libint2::int2 - library only -# Libint2::cxx - library + C++11 API +# Libint2::int2 - library with C API +# Libint2::cxx - Libint2::int2 plus interface to header-only C++11 API +# Libint2::int2-cxx - Libint2::int2 plus compiled C++11 API +# Libint2::fortran (NYI) # # # Suggested usage: @@ -55,7 +79,7 @@ # :: # # find_package(Libint2) -# find_package(Libint2 2.7.0 CONFIG REQUIRED COMPONENTS shared ss eri_c4_d0_l5 eri_c4_d1_l4) +# find_package(Libint2 2.7.1 CONFIG REQUIRED COMPONENTS shared sss eri_c4_d0_l5 eri_c4_d1_l4) # # # The following variables can be set to guide the search for this package: @@ -64,67 +88,77 @@ # # Libint2_DIR - CMake variable, set to directory containing this Config file # CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package -# PATH - environment variable, set to bin directory of this package # CMAKE_DISABLE_FIND_PACKAGE_Libint2 - CMake variable, disables # find_package(Libint2) when not REQUIRED, perhaps to force internal build @PACKAGE_INIT@ -set(PN Libint2) # ProjectName set(pnv libint2) # projectnameversion -set(NS Libint2) # NameSpace -set (_valid_components - static - shared - - eri_c4_d0_l2 - eri_c4_d0_l3 - eri_c4_d0_l4 - eri_c4_d0_l5 - eri_c4_d0_l6 - eri_c4_d0_l7 - eri_c4_d0_l8 - eri_c4_d0_l9 - eri_c4_d0_l10 - eri_c4_d1_l2 - eri_c4_d1_l3 - eri_c4_d1_l4 - eri_c4_d1_l5 - eri_c4_d1_l6 - eri_c4_d1_l7 - eri_c4_d1_l8 - eri_c4_d1_l9 - eri_c4_d1_l10 - - ss - so - is - io - gs - go - os - oo - bs - bo -) +set(L2 Libint2) # NameSpace + +set(Libint2_EXT_VERSION "@LIBINT_EXT_VERSION@") + +# make detectable the various cmake modules exported alongside +# * prepend to trump any pre-target FindEigen3.cmake modules lying around +list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) # check library style component -if(@BUILD_SHARED_LIBS@) - set(${PN}_shared_FOUND 1) +if(@BUILD_SHARED_LIBS@) # BUILD_SHARED_LIBS + set(${L2}_shared_FOUND 1) +endif() +if(@BUILD_STATIC_LIBS@) # BUILD_STATIC_LIBS + set(${L2}_static_FOUND 1) +endif() +list(FIND ${L2}_FIND_COMPONENTS "shared" _seek_shared) +list(FIND ${L2}_FIND_COMPONENTS "static" _seek_static) + +# check library language component +include(CMakeFindDependencyMacro) + +set(${L2}_C_FOUND 1) +list(FIND ${L2}_FIND_COMPONENTS "C" _seek_C) +if(@REQUIRE_CXX_API@) # REQUIRE_CXX_API + if(NOT TARGET Eigen3::Eigen) + find_dependency(Eigen3 REQUIRED) + endif() + + if (@LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS@) + # Boost headers _not_ unpacked to within `include/libint2/` + if (NOT TARGET Boost::headers) + find_dependency(Boost 1.57 REQUIRED) + endif() + else() + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Boost detected. satisfied by headers bundled with ${L2} distribution") + endif() + endif() + + set(${L2}_CXX_ho_FOUND 1) + + if(@REQUIRE_CXX_API_COMPILED@) # REQUIRE_CXX_API_COMPILED + set(${L2}_CXX_FOUND 1) + endif() endif() -if(@BUILD_STATIC_LIBS@) - set(${PN}_static_FOUND 1) +list(FIND ${L2}_FIND_COMPONENTS "CXX_ho" _seek_CXX_ho) +list(FIND ${L2}_FIND_COMPONENTS "CXX" _seek_CXX) +if(@ENABLE_FORTRAN@) # ENABLE_FORTRAN + set(${L2}_Fortran_FOUND 1) endif() -list(FIND ${PN}_FIND_COMPONENTS "shared" _seek_shared) -list(FIND ${PN}_FIND_COMPONENTS "static" _seek_static) +list(FIND ${L2}_FIND_COMPONENTS "Fortran" _seek_Fortran) # check AM & derivative component -set(${PN}_MAX_AM_ERI @Libint2_MAX_AM_ERI@) +set(${L2}_MAX_AM_ERI @Libint2_MAX_AM_ERI@) foreach(_eri @Libint2_ERI_COMPONENTS@) - set(${PN}_${_eri}_FOUND 1) + set(${L2}_${_eri}_FOUND 1) endforeach() -# check orderings component +# check pure restriction component +if((@ERI3_PURE_SH@ EQUAL 0) AND (@ERI2_PURE_SH@ EQUAL 0)) # ERI3/ERI2_PURE_SH + set(${L2}_impure_sh_FOUND 1) +endif() +list(FIND ${L2}_FIND_COMPONENTS "impure_sh" _seek_impure_sh) + +# check orderings component: LIBINT_SHGSHELL_ORDERING, LIBINT_CGSHELL_ORDERING, LIBINT_SHELL_SET if ((@LIBINT_SHGSHELL_ORDERING@ EQUAL 1) AND (@LIBINT_CGSHELL_ORDERING@ EQUAL 1) AND (@LIBINT_SHELL_SET@ EQUAL 1)) set(_ordering "sss") elseif((@LIBINT_SHGSHELL_ORDERING@ EQUAL 1) AND (@LIBINT_CGSHELL_ORDERING@ EQUAL 1) AND (@LIBINT_SHELL_SET@ EQUAL 2)) @@ -166,9 +200,9 @@ elseif((@LIBINT_SHGSHELL_ORDERING@ EQUAL 2) AND (@LIBINT_CGSHELL_ORDERING@ EQUAL elseif((@LIBINT_SHGSHELL_ORDERING@ EQUAL 2) AND (@LIBINT_CGSHELL_ORDERING@ EQUAL 5) AND (@LIBINT_SHELL_SET@ EQUAL 2)) set(_ordering "gbo") else() - message(STATUS "${PN}Config: indeterminate orderings") + message(STATUS "${L2}Config: indeterminate orderings") endif() -set(${PN}_${_ordering}_FOUND 1) +set(${L2}_${_ordering}_FOUND 1) # thanks, https://stackoverflow.com/a/9328525 @@ -194,51 +228,35 @@ endfunction() if(NOT CMAKE_REQUIRED_QUIET) - message(STATUS "${PN}Config components requested: ${${PN}_FIND_COMPONENTS}") - dump_cmake_variables("^Libint2_([A-Za-z0-9_]+)_FOUND$" "${PN}Config components found: ") + list(SORT ${L2}_FIND_COMPONENTS COMPARE STRING) + message(STATUS "${L2}Config components requested: ${${L2}_FIND_COMPONENTS}") + dump_cmake_variables("^Libint2_([A-Za-z0-9_]+)_FOUND$" "${L2}Config components found: ") endif() -check_required_components(${PN}) - -# make detectable the various cmake modules exported alongside -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) +check_required_components(${L2}) #----------------------------------------------------------------------------- # Don't include targets if this file is being picked up by another # project which has already built this as a subproject #----------------------------------------------------------------------------- -if(NOT TARGET ${NS}::cxx) +if(NOT TARGET ${L2}::int2) if(_seek_static GREATER -1) include("${CMAKE_CURRENT_LIST_DIR}/${pnv}-targets-static.cmake") elseif(_seek_shared GREATER -1) include("${CMAKE_CURRENT_LIST_DIR}/${pnv}-targets-shared.cmake") - elseif(@BUILD_SHARED_LIBS@) + elseif(@BUILD_SHARED_LIBS@) # BUILD_SHARED_LIBS include("${CMAKE_CURRENT_LIST_DIR}/${pnv}-targets-shared.cmake") - elseif(@BUILD_STATIC_LIBS@) + elseif(@BUILD_STATIC_LIBS@) # BUILD_STATIC_LIBS include("${CMAKE_CURRENT_LIST_DIR}/${pnv}-targets-static.cmake") endif() - include(CMakeFindDependencyMacro) - if (@LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS@) - # Boost headers _not_ unpacked to within `include/libint2/` - if (NOT TARGET Boost::boost) - find_dependency(Boost 1.57 REQUIRED) - endif() - endif() - - get_property(_loc TARGET ${NS}::cxx PROPERTY LOCATION) - set(${PN}_LIBRARY ${_loc}) - get_property(_ill TARGET ${NS}::cxx PROPERTY INTERFACE_LINK_LIBRARIES) - set(${PN}_LIBRARIES ${_ill}) - - get_property(_id TARGET ${NS}::cxx PROPERTY INCLUDE_DIRECTORIES) - set(${PN}_INCLUDE_DIR ${_id}) - get_property(_iid TARGET ${NS}::cxx PROPERTY INTERFACE_INCLUDE_DIRECTORIES) - set(${PN}_INCLUDE_DIRS ${_iid}) - - #message("Libint2::cxx") - #message("loc ${_loc}") - #message("ill ${_ill}") - #message("id ${_id}") - #message("iid ${_iid}") + get_property(_loc TARGET ${L2}::int2 PROPERTY LOCATION) + get_property(_ill TARGET ${L2}::int2 PROPERTY INTERFACE_LINK_LIBRARIES) + get_property(_id TARGET ${L2}::int2 PROPERTY INCLUDE_DIRECTORIES) + get_property(_iid TARGET ${L2}::int2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + message(DEBUG "Libint2::int2") + message(DEBUG "loc ${_loc}") + message(DEBUG "ill ${_ill}") + message(DEBUG "id ${_id}") + message(DEBUG "iid ${_iid}") endif() diff --git a/cmake/libint2.pc.cmake.in b/cmake/libint2.pc.cmake.in index 70ea50542..63c260348 100644 --- a/cmake/libint2.pc.cmake.in +++ b/cmake/libint2.pc.cmake.in @@ -1,7 +1,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=@CMAKE_INSTALL_PREFIX@ -libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ +libdir=@libdir_for_pc_file@ +includedir=@includedir_for_pc_file@ Name: libint2 Description: a library for the evaluation of molecular integrals of many-body operators over Gaussian functions diff --git a/cmake/modules/FindEigen3.cmake b/cmake/modules/FindEigen3.cmake new file mode 100644 index 000000000..2a9c9357b --- /dev/null +++ b/cmake/modules/FindEigen3.cmake @@ -0,0 +1,134 @@ +# FindEigen3.cmake +# ---------------- +# +# Eigen3 cmake module to wrap Eigen3 suitable for Libint2. Copied from Eigen v3.4.0 source and modified as follows: +# * Added `NO_CMAKE_PACKAGE_REGISTRY` to `find_package(Eigen3 ...)` to avoid issues with wiped build +# directory when looking for installed eigen. Eigen3 registers its *build* tree with the user package registry. +# * Added `LIBINT_LOCAL_Eigen3_FIND` block to forcibly load hard-coded Eigen3 location detected during Libint2 library build. +# * Move default Eigen3_FIND_VERSION_* from 2.91.0 to 3.0.0 so that it doesn't reject Eigen v3 installations. +# +# - Try to find Eigen3 lib +# +# This module supports requiring a minimum version, e.g. you can do +# find_package(Eigen3 3.1.2) +# to require version 3.1.2 or newer of Eigen3. +# +# Once done this will define +# +# EIGEN3_FOUND - system has eigen lib with correct version +# EIGEN3_INCLUDE_DIR - the eigen include directory +# EIGEN3_VERSION - eigen version +# +# and the following imported target: +# +# Eigen3::Eigen - The header-only Eigen library +# +# This module reads hints about search locations from +# the following environment variables: +# +# EIGEN3_ROOT +# EIGEN3_ROOT_DIR + +# Copyright (c) 2006, 2007 Montel Laurent, +# Copyright (c) 2008, 2009 Gael Guennebaud, +# Copyright (c) 2009 Benoit Jacob +# Redistribution and use is allowed according to the terms of the 2-clause BSD license. + +if(NOT Eigen3_FIND_VERSION) + if(NOT Eigen3_FIND_VERSION_MAJOR) + set(Eigen3_FIND_VERSION_MAJOR 3) + endif() + if(NOT Eigen3_FIND_VERSION_MINOR) + set(Eigen3_FIND_VERSION_MINOR 0) + endif() + if(NOT Eigen3_FIND_VERSION_PATCH) + set(Eigen3_FIND_VERSION_PATCH 0) + endif() + + set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}") +endif() + +macro(_eigen3_check_version) + file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header) + + string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}") + set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}") + string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}") + set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}") + string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}") + set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}") + + set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION}) + if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION}) + set(EIGEN3_VERSION_OK FALSE) + else() + set(EIGEN3_VERSION_OK TRUE) + endif() + + if(NOT EIGEN3_VERSION_OK) + + message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, " + "but at least version ${Eigen3_FIND_VERSION} is required") + endif() +endmacro() + +if (LIBINT_LOCAL_Eigen3_FIND) + include("${CMAKE_CURRENT_LIST_DIR}/libint2-targets-eigen3.cmake") + + if (TARGET Libint2::Eigen) + get_property(_EIGEN3_INCLUDE_DIRS TARGET Libint2::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + list(GET _EIGEN3_INCLUDE_DIRS 0 EIGEN3_INCLUDE_DIR) + + _eigen3_check_version() + set(EIGEN3_FOUND ${EIGEN3_VERSION_OK}) + set(Eigen3_FOUND ${EIGEN3_VERSION_OK}) + + add_library(Eigen3::Eigen ALIAS Libint2::Eigen) + else() + message(STATUS "Eigen3 exact installation detected/used by Libint library build requested " + "from ${CMAKE_CURRENT_LIST_DIR}/libint2-targets-eigen3.cmake but failed.") + endif() + +elseif (EIGEN3_INCLUDE_DIR) + + # in cache already + _eigen3_check_version() + set(EIGEN3_FOUND ${EIGEN3_VERSION_OK}) + set(Eigen3_FOUND ${EIGEN3_VERSION_OK}) + +else () + + # search first if an Eigen3Config.cmake is available in the system, + # if successful this would set EIGEN3_INCLUDE_DIR and the rest of + # the script will work as usual + find_package(Eigen3 ${Eigen3_FIND_VERSION} NO_MODULE QUIET NO_CMAKE_PACKAGE_REGISTRY) + + if(NOT EIGEN3_INCLUDE_DIR) + find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library + HINTS + ENV EIGEN3_ROOT + ENV EIGEN3_ROOT_DIR + PATHS + ${CMAKE_INSTALL_PREFIX}/include + ${KDE4_INCLUDE_DIR} + PATH_SUFFIXES eigen3 eigen + ) + endif() + + if(EIGEN3_INCLUDE_DIR) + _eigen3_check_version() + endif() + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK) + + mark_as_advanced(EIGEN3_INCLUDE_DIR) + +endif() + +if(EIGEN3_FOUND AND NOT TARGET Eigen3::Eigen) + add_library(Eigen3::Eigen INTERFACE IMPORTED) + set_target_properties(Eigen3::Eigen PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${EIGEN3_INCLUDE_DIR}") +endif() + diff --git a/cmake/modules/FindGMP.cmake b/cmake/modules/FindGMP.cmake deleted file mode 100644 index 512639622..000000000 --- a/cmake/modules/FindGMP.cmake +++ /dev/null @@ -1,139 +0,0 @@ -# Try to find the GMP library -# See http://www.gmplib.org/ -# -# This module supports requiring a minimum version, e.g. you can do -# find_package(MPFR 2.3.0) -# to require version 2.3.0 to newer of MPFR. -# -# Once done this will define -# -# MPFR_FOUND - system has MPFR lib with correct version -# MPFR_INCLUDE - the MPFR include directory -# MPFR_LIBRARY - the MPFR library -# MPFR_VERSION - MPFR version -# MPFR::GMP -# MPFR::GMPXX -# MPFR::MPFR -# MPFR::MPFRXX - -# Copyright (c) 2006, 2007 Montel Laurent, -# Copyright (c) 2008, 2009 Gael Guennebaud, -# Copyright (c) 2010 Jitse Niesen, -# Copyright (c) 2015 Jack Poulson, -# Redistribution and use is allowed according to the terms of the BSD license. - -#message("prefix: ${CMAKE_FIND_LIBRARY_PREFIXES}") -#message("suffix: ${CMAKE_FIND_LIBRARY_SUFFIXES}") -if(MSVC) - list(INSERT CMAKE_FIND_LIBRARY_SUFFIXES 0 ".dll") -endif() -#message("suffix: ${CMAKE_FIND_LIBRARY_SUFFIXES}") -#message("root: ${MPFR_ROOT}") - -find_path(MPFR_INCLUDE NAMES mpfr.h PATHS $ENV{GMPDIR} $ENV{MPFRDIR} - ${INCLUDE_INSTALL_DIR}) - -# Set MPFR_FIND_VERSION to 1.0.0 if no minimum version is specified -if(NOT MPFR_FIND_VERSION) - if(NOT MPFR_FIND_VERSION_MAJOR) - set(MPFR_FIND_VERSION_MAJOR 1) - endif() - if(NOT MPFR_FIND_VERSION_MINOR) - set(MPFR_FIND_VERSION_MINOR 0) - endif() - if(NOT MPFR_FIND_VERSION_PATCH) - set(MPFR_FIND_VERSION_PATCH 0) - endif() - set(MPFR_FIND_VERSION - "${MPFR_FIND_VERSION_MAJOR}.${MPFR_FIND_VERSION_MINOR}.${MPFR_FIND_VERSION_PATCH}") -endif() - -if(MPFR_INCLUDE) - # Query MPFR_VERSION - file(READ "${MPFR_INCLUDE}/mpfr.h" _mpfr_version_header) - - string(REGEX MATCH "define[ \t]+MPFR_VERSION_MAJOR[ \t]+([0-9]+)" - _mpfr_major_version_match "${_mpfr_version_header}") - set(MPFR_MAJOR_VERSION "${CMAKE_MATCH_1}") - string(REGEX MATCH "define[ \t]+MPFR_VERSION_MINOR[ \t]+([0-9]+)" - _mpfr_minor_version_match "${_mpfr_version_header}") - set(MPFR_MINOR_VERSION "${CMAKE_MATCH_1}") - string(REGEX MATCH "define[ \t]+MPFR_VERSION_PATCHLEVEL[ \t]+([0-9]+)" - _mpfr_patchlevel_version_match "${_mpfr_version_header}") - set(MPFR_PATCHLEVEL_VERSION "${CMAKE_MATCH_1}") - - set(MPFR_VERSION - ${MPFR_MAJOR_VERSION}.${MPFR_MINOR_VERSION}.${MPFR_PATCHLEVEL_VERSION}) - - # Check whether found version exceeds minimum required - if(${MPFR_VERSION} VERSION_LESS ${MPFR_FIND_VERSION}) - set(MPFR_VERSION_OK FALSE) - message(STATUS "MPFR version ${MPFR_VERSION} found in ${MPFR_INCLUDE}, " - "but at least version ${MPFR_FIND_VERSION} is required") - else() - set(MPFR_VERSION_OK TRUE) - endif() -endif() - -find_library(MPFR_LIBRARY - NAMES mpfr - PATHS $ENV{GMPDIR} $ENV{MPFRDIR} ${LIB_INSTALL_DIR} - PATH_SUFFIXES bin ${MPFR_ROOT}/bin) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(MPFR DEFAULT_MSG - MPFR_INCLUDE MPFR_LIBRARY MPFR_VERSION_OK) -mark_as_advanced(MPFR_INCLUDE MPFR_LIBRARY) - -if(MPFR_INCLUDE AND MPFR_LIBRARY AND NOT TARGET MPFR::Library) - add_library(MPFR::Library INTERFACE IMPORTED) - set_target_properties(MPFR::Library - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${MPFR_INCLUDE} - INTERFACE_LINK_LIBRARIES ${MPFR_LIBRARY}) -endif() - -# from GMP, Libint2 build_libint needs the C++ header and MPFR needs the C library -# test needs the C++ library -find_path(GMP_INCLUDE - NAMES gmp.h - PATHS $ENV{GMPDIR} $ENV{MPFRDIR} ${INCLUDE_INSTALL_DIR}) -find_library(GMP_LIBRARY - NAMES gmp - PATHS $ENV{GMPDIR} $ENV{MPFRDIR} ${LIB_INSTALL_DIR} - PATH_SUFFIXES bin ${MPFR_ROOT}/bin) - -if (GMP_INCLUDE AND GMP_LIBRARY AND NOT TARGET MPFR::GMP) - add_library(MPFR::GMP INTERFACE IMPORTED) - set_target_properties(MPFR::GMP - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${GMP_INCLUDE} - INTERFACE_LINK_LIBRARIES ${GMP_LIBRARY}) -endif() - -if (TARGET MPFR::GMP AND TARGET MPFR::Library AND NOT TARGET MPFR::MPFR) - add_library(MPFR::MPFR INTERFACE IMPORTED) - target_link_libraries(MPFR::MPFR INTERFACE MPFR::Library MPFR::GMP) -endif() - - -find_path(GMPXX_INCLUDE - NAMES gmpxx.h - PATHS $ENV{GMPDIR} $ENV{MPFRDIR} ${INCLUDE_INSTALL_DIR}) -find_library(GMPXX_LIBRARY - NAMES gmpxx -# gmpxx_static - gmp # gmp.dll on Win c-f conda package contains cxx (actually a copy of mpir, a drop-in replacement for gmp) - PATHS $ENV{GMPDIR} $ENV{MPFRDIR} ${LIB_INSTALL_DIR} - PATH_SUFFIXES bin ${MPFR_ROOT}/bin) - -if (GMPXX_INCLUDE AND GMPXX_LIBRARY AND TARGET MPFR::GMP AND NOT TARGET MPFR::GMPXX) - add_library(MPFR::GMPXX INTERFACE IMPORTED) - set_target_properties(MPFR::GMPXX - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${GMPXX_INCLUDE} - INTERFACE_LINK_LIBRARIES ${GMPXX_LIBRARY}) - target_link_libraries(MPFR::GMPXX INTERFACE MPFR::GMP) -endif() - -if (TARGET MPFR::GMPXX AND TARGET MPFR::Library AND NOT TARGET MPFR::MPFRXX) - add_library(MPFR::MPFRXX INTERFACE IMPORTED) - target_link_libraries(MPFR::MPFRXX INTERFACE MPFR::Library MPFR::GMPXX) -endif() diff --git a/cmake/modules/FindMPFR.cmake b/cmake/modules/FindMPFR.cmake deleted file mode 100644 index fd1854707..000000000 --- a/cmake/modules/FindMPFR.cmake +++ /dev/null @@ -1,139 +0,0 @@ -# Try to find the MPFR library -# See http://www.mpfr.org/ -# -# This module supports requiring a minimum version, e.g. you can do -# find_package(MPFR 2.3.0) -# to require version 2.3.0 to newer of MPFR. -# -# Once done this will define -# -# MPFR_FOUND - system has MPFR lib with correct version -# MPFR_INCLUDE - the MPFR include directory -# MPFR_LIBRARY - the MPFR library -# MPFR_VERSION - MPFR version -# MPFR::GMP -# MPFR::GMPXX -# MPFR::MPFR -# MPFR::MPFRXX - -# Copyright (c) 2006, 2007 Montel Laurent, -# Copyright (c) 2008, 2009 Gael Guennebaud, -# Copyright (c) 2010 Jitse Niesen, -# Copyright (c) 2015 Jack Poulson, -# Redistribution and use is allowed according to the terms of the BSD license. - -#message("prefix: ${CMAKE_FIND_LIBRARY_PREFIXES}") -#message("suffix: ${CMAKE_FIND_LIBRARY_SUFFIXES}") -if(MSVC) - list(INSERT CMAKE_FIND_LIBRARY_SUFFIXES 0 ".dll") -endif() -#message("suffix: ${CMAKE_FIND_LIBRARY_SUFFIXES}") -#message("root: ${MPFR_ROOT}") - -find_path(MPFR_INCLUDE NAMES mpfr.h PATHS $ENV{GMPDIR} $ENV{MPFRDIR} - ${INCLUDE_INSTALL_DIR}) - -# Set MPFR_FIND_VERSION to 1.0.0 if no minimum version is specified -if(NOT MPFR_FIND_VERSION) - if(NOT MPFR_FIND_VERSION_MAJOR) - set(MPFR_FIND_VERSION_MAJOR 1) - endif() - if(NOT MPFR_FIND_VERSION_MINOR) - set(MPFR_FIND_VERSION_MINOR 0) - endif() - if(NOT MPFR_FIND_VERSION_PATCH) - set(MPFR_FIND_VERSION_PATCH 0) - endif() - set(MPFR_FIND_VERSION - "${MPFR_FIND_VERSION_MAJOR}.${MPFR_FIND_VERSION_MINOR}.${MPFR_FIND_VERSION_PATCH}") -endif() - -if(MPFR_INCLUDE) - # Query MPFR_VERSION - file(READ "${MPFR_INCLUDE}/mpfr.h" _mpfr_version_header) - - string(REGEX MATCH "define[ \t]+MPFR_VERSION_MAJOR[ \t]+([0-9]+)" - _mpfr_major_version_match "${_mpfr_version_header}") - set(MPFR_MAJOR_VERSION "${CMAKE_MATCH_1}") - string(REGEX MATCH "define[ \t]+MPFR_VERSION_MINOR[ \t]+([0-9]+)" - _mpfr_minor_version_match "${_mpfr_version_header}") - set(MPFR_MINOR_VERSION "${CMAKE_MATCH_1}") - string(REGEX MATCH "define[ \t]+MPFR_VERSION_PATCHLEVEL[ \t]+([0-9]+)" - _mpfr_patchlevel_version_match "${_mpfr_version_header}") - set(MPFR_PATCHLEVEL_VERSION "${CMAKE_MATCH_1}") - - set(MPFR_VERSION - ${MPFR_MAJOR_VERSION}.${MPFR_MINOR_VERSION}.${MPFR_PATCHLEVEL_VERSION}) - - # Check whether found version exceeds minimum required - if(${MPFR_VERSION} VERSION_LESS ${MPFR_FIND_VERSION}) - set(MPFR_VERSION_OK FALSE) - message(STATUS "MPFR version ${MPFR_VERSION} found in ${MPFR_INCLUDE}, " - "but at least version ${MPFR_FIND_VERSION} is required") - else() - set(MPFR_VERSION_OK TRUE) - endif() -endif() - -find_library(MPFR_LIBRARY - NAMES mpfr - PATHS $ENV{GMPDIR} $ENV{MPFRDIR} ${LIB_INSTALL_DIR} - PATH_SUFFIXES bin ${MPFR_ROOT}/bin) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(MPFR DEFAULT_MSG - MPFR_INCLUDE MPFR_LIBRARY MPFR_VERSION_OK) -mark_as_advanced(MPFR_INCLUDE MPFR_LIBRARY) - -if(MPFR_INCLUDE AND MPFR_LIBRARY AND NOT TARGET MPFR::Library) - add_library(MPFR::Library INTERFACE IMPORTED) - set_target_properties(MPFR::Library - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${MPFR_INCLUDE} - INTERFACE_LINK_LIBRARIES ${MPFR_LIBRARY}) -endif() - -# from GMP, Libint2 build_libint needs the C++ header and MPFR needs the C library -# test needs the C++ library -find_path(GMP_INCLUDE - NAMES gmp.h - PATHS $ENV{GMPDIR} $ENV{MPFRDIR} ${INCLUDE_INSTALL_DIR}) -find_library(GMP_LIBRARY - NAMES gmp - PATHS $ENV{GMPDIR} $ENV{MPFRDIR} ${LIB_INSTALL_DIR} - PATH_SUFFIXES bin ${MPFR_ROOT}/bin) - -if (GMP_INCLUDE AND GMP_LIBRARY AND NOT TARGET MPFR::GMP) - add_library(MPFR::GMP INTERFACE IMPORTED) - set_target_properties(MPFR::GMP - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${GMP_INCLUDE} - INTERFACE_LINK_LIBRARIES ${GMP_LIBRARY}) -endif() - -if (TARGET MPFR::GMP AND TARGET MPFR::Library AND NOT TARGET MPFR::MPFR) - add_library(MPFR::MPFR INTERFACE IMPORTED) - target_link_libraries(MPFR::MPFR INTERFACE MPFR::Library MPFR::GMP) -endif() - - -find_path(GMPXX_INCLUDE - NAMES gmpxx.h - PATHS $ENV{GMPDIR} $ENV{MPFRDIR} ${INCLUDE_INSTALL_DIR}) -find_library(GMPXX_LIBRARY - NAMES gmpxx -# gmpxx_static - gmp # gmp.dll on Win c-f conda package contains cxx (actually a copy of mpir, a drop-in replacement for gmp) - PATHS $ENV{GMPDIR} $ENV{MPFRDIR} ${LIB_INSTALL_DIR} - PATH_SUFFIXES bin ${MPFR_ROOT}/bin) - -if (GMPXX_INCLUDE AND GMPXX_LIBRARY AND TARGET MPFR::GMP AND NOT TARGET MPFR::GMPXX) - add_library(MPFR::GMPXX INTERFACE IMPORTED) - set_target_properties(MPFR::GMPXX - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${GMPXX_INCLUDE} - INTERFACE_LINK_LIBRARIES ${GMPXX_LIBRARY}) - target_link_libraries(MPFR::GMPXX INTERFACE MPFR::GMP) -endif() - -if (TARGET MPFR::GMPXX AND TARGET MPFR::Library AND NOT TARGET MPFR::MPFRXX) - add_library(MPFR::MPFRXX INTERFACE IMPORTED) - target_link_libraries(MPFR::MPFRXX INTERFACE MPFR::Library MPFR::GMPXX) -endif() diff --git a/cmake/modules/FindMultiprecision.cmake b/cmake/modules/FindMultiprecision.cmake new file mode 100644 index 000000000..d7c2e98c9 --- /dev/null +++ b/cmake/modules/FindMultiprecision.cmake @@ -0,0 +1,346 @@ +# FindMultiprecision.cmake +# ------------------------ +# +# GMP, MPIR, MPFR CMake module. +# +# Built upon FindMPFR.cmake by +# Copyright (c) 2006, 2007 Montel Laurent, +# Copyright (c) 2008, 2009 Gael Guennebaud, +# Copyright (c) 2010 Jitse Niesen, +# Copyright (c) 2015 Jack Poulson, +# Redistribution and use is allowed according to the terms of the BSD license. +# +# +## This module supports requiring a minimum version, e.g. you can do +## find_package(MPFR 2.3.0) +## to require version 2.3.0 to newer of MPFR. +## +# This module sets the following variables in your project: +# +# :: +# +# Multiprecision_FOUND - true if all required components of MPFR found on the system with correct version +# MPFR_VERSION - MPFR version if mpfr library detected +# +# +# Available components: +# +# :: +# +# gmp - search for at least Multiprecision::gmp target +# gmpxx - search for at least Multiprecision::gmpxx target +# mpfr - search for at least Multiprecision::mpfr target +# +# +# Exported targets: +# +# :: +# +# If no components are requested, this module defines at least the following +# :prop_tgt:`IMPORTED` target. :: +# +# Multiprecision::gmp - gmp.h and GMP library +# +# Depending on components requested, this module defines up to the following +# :prop_tgt:`IMPORTED` targets. :: +# +# Multiprecision::gmp - gmp.h and C GMP library +# Multiprecision::mpfr - mpfr.h and MPFR library (needs Multiprecision::gmp) +# Multiprecision::gmpxx - gmpxx.h and C++ GMP library (needs Multiprecision::gmp) +# +# +# Suggested usage: +# +# :: +# +# find_package(Multiprecision) +# find_package(Multiprecision 4.0.0 REQUIRED COMPONENTS mpfr) +# +# +# The following variables can be set to guide the search for this package: +# +# :: +# +## Libint2_DIR - CMake variable, set to directory containing this Config file +# CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package +## PATH - environment variable, set to bin directory of this package +## CMAKE_DISABLE_FIND_PACKAGE_Libint2 - CMake variable, disables +## find_package(Libint2) when not REQUIRED, perhaps to force internal build + +# if no components given, act like a FindGMP +list(LENGTH Multiprecision_FIND_COMPONENTS _lcomp) +if (_lcomp EQUAL 0) + list(APPEND Multiprecision_FIND_COMPONENTS gmp) +endif() + +#message("prefix: ${CMAKE_FIND_LIBRARY_PREFIXES}") +#message("suffix: ${CMAKE_FIND_LIBRARY_SUFFIXES}") +if(WIN32) + list(INSERT CMAKE_FIND_LIBRARY_SUFFIXES 0 ".dll") +endif() +#message("suffix: ${CMAKE_FIND_LIBRARY_SUFFIXES}") +#message("root: ${Multiprecision_ROOT}") + +find_path( + MPFR_INCLUDE + NAMES + mpfr.h + PATHS + $ENV{GMPDIR} + $ENV{MPFRDIR} + ${INCLUDE_INSTALL_DIR} + #NO_SYSTEM_ENVIRONMENT_PATH + #NO_CMAKE_SYSTEM_PATH + ) + +# Set MPFR_FIND_VERSION to 1.0.0 if no minimum version is specified +if(NOT MPFR_FIND_VERSION) + if(NOT MPFR_FIND_VERSION_MAJOR) + set(MPFR_FIND_VERSION_MAJOR 1) + endif() + if(NOT MPFR_FIND_VERSION_MINOR) + set(MPFR_FIND_VERSION_MINOR 0) + endif() + if(NOT MPFR_FIND_VERSION_PATCH) + set(MPFR_FIND_VERSION_PATCH 0) + endif() + set(MPFR_FIND_VERSION + "${MPFR_FIND_VERSION_MAJOR}.${MPFR_FIND_VERSION_MINOR}.${MPFR_FIND_VERSION_PATCH}") +endif() + +if(MPFR_INCLUDE) + # Query MPFR_VERSION + file(READ "${MPFR_INCLUDE}/mpfr.h" _mpfr_version_header) + + string(REGEX MATCH "define[ \t]+MPFR_VERSION_MAJOR[ \t]+([0-9]+)" + _mpfr_major_version_match "${_mpfr_version_header}") + set(MPFR_MAJOR_VERSION "${CMAKE_MATCH_1}") + string(REGEX MATCH "define[ \t]+MPFR_VERSION_MINOR[ \t]+([0-9]+)" + _mpfr_minor_version_match "${_mpfr_version_header}") + set(MPFR_MINOR_VERSION "${CMAKE_MATCH_1}") + string(REGEX MATCH "define[ \t]+MPFR_VERSION_PATCHLEVEL[ \t]+([0-9]+)" + _mpfr_patchlevel_version_match "${_mpfr_version_header}") + set(MPFR_PATCHLEVEL_VERSION "${CMAKE_MATCH_1}") + + set(MPFR_VERSION + ${MPFR_MAJOR_VERSION}.${MPFR_MINOR_VERSION}.${MPFR_PATCHLEVEL_VERSION}) + + # Check whether found version exceeds minimum required + if(${MPFR_VERSION} VERSION_LESS ${MPFR_FIND_VERSION}) + set(MPFR_VERSION_OK FALSE) + message(STATUS "MPFR version ${MPFR_VERSION} found in ${MPFR_INCLUDE}, " + "but at least version ${MPFR_FIND_VERSION} is required") + else() + set(MPFR_VERSION_OK TRUE) + endif() +endif() + +# todo Multiprecision/MPFR version + +find_library( + MPFR_LIBRARY + NAMES + mpfr + PATHS + $ENV{GMPDIR} + $ENV{MPFRDIR} + ${LIB_INSTALL_DIR} + PATH_SUFFIXES + bin + ${MPFR_ROOT}/bin + ) + +find_path( + GMP_INCLUDE + NAMES + gmp.h + PATHS + $ENV{GMPDIR} + $ENV{MPFRDIR} + ${INCLUDE_INSTALL_DIR} + #NO_SYSTEM_ENVIRONMENT_PATH + #NO_CMAKE_SYSTEM_PATH + ) + +find_library( + GMP_LIBRARY + NAMES + gmp + PATHS + $ENV{GMPDIR} + $ENV{MPFRDIR} + ${LIB_INSTALL_DIR} + PATH_SUFFIXES + bin + ${MPFR_ROOT}/bin + ) + +find_path( + GMPXX_INCLUDE + NAMES + gmpxx.h + PATHS + $ENV{GMPDIR} + $ENV{MPFRDIR} + ${INCLUDE_INSTALL_DIR} + #NO_SYSTEM_ENVIRONMENT_PATH + #NO_CMAKE_SYSTEM_PATH + ) + +find_library( + GMPXX_LIBRARY + NAMES + gmpxx + gmp # gmp.dll on Win c-f conda package contains cxx (actually a copy of mpir, a drop-in replacement for gmp) + PATHS + $ENV{GMPDIR} + $ENV{MPFRDIR} + ${LIB_INSTALL_DIR} + PATH_SUFFIXES + bin + ${MPFR_ROOT}/bin + ) + +#message("GMP ${GMP_INCLUDE} ${GMP_LIBRARY}") +#message("GMPXX ${GMPXX_INCLUDE} ${GMPXX_LIBRARY}") +#message("MPFR ${MPFR_INCLUDE} ${MPFR_LIBRARY}") +if (GMP_INCLUDE AND GMP_LIBRARY) + set(Multiprecision_gmp_FOUND 1) # Multiprecision::gmp + + if (MPFR_INCLUDE AND MPFR_LIBRARY AND MPFR_VERSION_OK) + set(Multiprecision_mpfr_FOUND 1) # Multiprecision::mpfr + endif() + + if (GMPXX_INCLUDE AND GMPXX_LIBRARY) + set(Multiprecision_gmpxx_FOUND 1) # Multiprecision::gmpxx + endif() +endif() + +# thanks, https://stackoverflow.com/a/9328525 +function(dump_cmake_variables) + get_cmake_property(_variableNames VARIABLES) + list (SORT _variableNames) + set(founds "") + foreach (_variableName ${_variableNames}) + if (ARGV0) + unset(MATCHED) + string(REGEX MATCH ${ARGV0} MATCHED ${_variableName}) + if (NOT MATCHED) + continue() + endif() + if (NOT ${${_variableName}}) + continue() + endif() + endif() + list(APPEND founds ${CMAKE_MATCH_1}) + endforeach() + message(STATUS "${ARGV1}${founds}") +endfunction() + +macro(check_required_components _NAME) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(NOT ${_NAME}_${comp}_FOUND) + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() + + +if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "FindMultiprecision components requested: ${Multiprecision_FIND_COMPONENTS}") + dump_cmake_variables("^Multiprecision_([A-Za-z0-9_]+)_FOUND$" "FindMultiprecision components found: ") +endif() + +set(Multiprecision_FOUND 1) +check_required_components(Multiprecision) +find_package_handle_standard_args( + Multiprecision + REQUIRED_VARS # can be removed upon CMake 3.18 + GMP_LIBRARY + GMP_INCLUDE + Multiprecision_FOUND + VERSION_VAR MPFR_VERSION + HANDLE_COMPONENTS + ) + + +if(WIN32) + string( REPLACE ".lib" ".dll" GMP_LIBRARY_DLL "${GMP_LIBRARY}" ) + string( REPLACE ".lib" ".dll" GMPXX_LIBRARY_DLL "${GMPXX_LIBRARY}" ) + string( REPLACE ".lib" ".dll" MPFR_LIBRARY_DLL "${MPFR_LIBRARY}" ) +endif() + +# now that `find_package(Multiprecision COMPONENTS ...)` will succeed, create targets +if ((Multiprecision_gmp_FOUND EQUAL 1) AND NOT TARGET Multiprecision::gmp) + if (EXISTS "${GMP_LIBRARY_DLL}") + add_library(Multiprecision::gmp SHARED IMPORTED) + set_target_properties( + Multiprecision::gmp + PROPERTIES + IMPORTED_LOCATION "${GMP_LIBRARY_DLL}" + IMPORTED_IMPLIB "${GMP_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GMP_INCLUDE}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + ) + else() + add_library(Multiprecision::gmp UNKNOWN IMPORTED) + set_target_properties( + Multiprecision::gmp + PROPERTIES + IMPORTED_LOCATION "${GMP_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GMP_INCLUDE}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + ) + endif() +endif() + +if ((Multiprecision_mpfr_FOUND EQUAL 1) AND NOT TARGET Multiprecision::mpfr) + if (EXISTS "${MPFR_LIBRARY_DLL}") + add_library(Multiprecision::mpfr SHARED IMPORTED) + set_target_properties( + Multiprecision::mpfr + PROPERTIES + IMPORTED_LOCATION "${MPFR_LIBRARY_DLL}" + IMPORTED_IMPLIB "${MPFR_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${MPFR_INCLUDE}" + INTERFACE_LINK_LIBRARIES Multiprecision::gmp + ) + else() + add_library(Multiprecision::mpfr UNKNOWN IMPORTED) + set_target_properties( + Multiprecision::mpfr + PROPERTIES + IMPORTED_LOCATION "${MPFR_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${MPFR_INCLUDE}" + INTERFACE_LINK_LIBRARIES Multiprecision::gmp + ) + endif() +endif() + +if ((Multiprecision_gmpxx_FOUND EQUAL 1) AND NOT TARGET Multiprecision::gmpxx) + if (EXISTS "${GMPXX_LIBRARY_DLL}") + add_library(Multiprecision::gmpxx SHARED IMPORTED) + set_target_properties( + Multiprecision::gmp + PROPERTIES + IMPORTED_LOCATION "${GMPXX_LIBRARY_DLL}" + IMPORTED_IMPLIB "${GMPXX_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GMPXX_INCLUDE}" + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + INTERFACE_LINK_LIBRARIES Multiprecision::gmp + ) + else() + add_library(Multiprecision::gmpxx UNKNOWN IMPORTED) + set_target_properties( + Multiprecision::gmpxx + PROPERTIES + IMPORTED_LOCATION "${GMPXX_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GMPXX_INCLUDE}" + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + INTERFACE_LINK_LIBRARIES Multiprecision::gmp + ) + endif() +endif() + diff --git a/cmake/modules/JoinPaths.cmake b/cmake/modules/JoinPaths.cmake new file mode 100644 index 000000000..c68d91b84 --- /dev/null +++ b/cmake/modules/JoinPaths.cmake @@ -0,0 +1,23 @@ +# This module provides function for joining paths +# known from most languages +# +# SPDX-License-Identifier: (MIT OR CC0-1.0) +# Copyright 2020 Jan Tojnar +# https://github.com/jtojnar/cmake-snips +# +# Modelled after Python’s os.path.join +# https://docs.python.org/3.7/library/os.path.html#os.path.join +# Windows not supported +function(join_paths joined_path first_path_segment) + set(temp_path "${first_path_segment}") + foreach(current_segment IN LISTS ARGN) + if(NOT ("${current_segment}" STREQUAL "")) + if(IS_ABSOLUTE "${current_segment}") + set(temp_path "${current_segment}") + else() + set(temp_path "${temp_path}/${current_segment}") + endif() + endif() + endforeach() + set(${joined_path} "${temp_path}" PARENT_SCOPE) +endfunction() diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index 94a09ae5d..f4b15a6e4 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -3,105 +3,146 @@ # * [LIBINT|ONEBODY|ERI2|ERI3|ERI|G12|G12DKH]_[MAX|OPT]_AM[|_LIST] # * LIBINT_ONEBODY_DERIV # * LIBINT_SUPPORTS_ONEBODY +# * SUPPORT_T1G12 # _candidate variables not needed for config.h but are used to figure -# out the AM levels at the CMake level -# so that libint2-config components may be defined and client codes can -# require the detected library include gradient integrals up to AM=5 with -# `find_package(Libint2 COMPONENTS g5)` +# out the AM levels at the CMake level so that +# libint2-config.cmake components may be defined and client codes can +# require the detected library include gradient integrals at least AM=5 with +# `find_package(Libint2 COMPONENTS eri_c4_d1_l5)` + + +macro(numerical_max_of_list ansvar liste) + set(_max "-100") + foreach(_i ${liste}) + if (${_i} GREATER _max) + set(_max "${_i}") + endif() + endforeach() + set(${ansvar} "${_max}") +endmacro() message(STATUS "Processing integrals classes ...") -# <<< overall defaults (LIBINT_MAX/OPT_AM) >>> +# <<< overall derivatives level >>> -message(STATUS "WITH_MAX_AM=${WITH_MAX_AM}") -list(LENGTH WITH_MAX_AM _ntokens) -if (_ntokens GREATER 1) +set(_glob_classes_derivs ${ENABLE_ONEBODY};${ENABLE_ERI};${ENABLE_ERI3};${ENABLE_ERI2};${ENABLE_G12};${ENABLE_G12DKH}) +numerical_max_of_list(_max_deriv "${_glob_classes_derivs}") +message(STATUS "Preparing highest derivative level ${_max_deriv}") - set(_given_max_am_list TRUE) - set(_max_am 0) - math(EXPR _max_deriv "${_ntokens} - 1") - foreach(_d RANGE 0 ${_max_deriv}) - list(GET WITH_MAX_AM ${_d} _max_am_default_d${_d}) - if (${_max_am_default_d${_d}} GREATER _max_am) - set(_max_am ${_max_am_default_d${_d}}) - endif() - endforeach() +# <<< overall max_am defaults >>> +list(LENGTH WITH_MAX_AM _ntokens_maxam) +if (_ntokens_maxam GREATER 1) + math(EXPR _ntokens_xptd_max_deriv "${_max_deriv} + 1") + if (NOT _ntokens_xptd_max_deriv EQUAL _ntokens_maxam) + message(FATAL_ERROR "Invalid value for WITH_MAX_AM (${WITH_MAX_AM}). Highest ENABLE_ derivative (${_max_deriv}) requires list length ${_ntokens_xptd_max_deriv}, not ${_ntokens_maxam}.") + endif() + + numerical_max_of_list(_max_am "${WITH_MAX_AM}") list(JOIN WITH_MAX_AM "," _sam) set(LIBINT_MAX_AM_LIST ${_sam}) set(LIBINT_MAX_AM ${_max_am}) # only overall LIBINT, not specific integrals classes, sets both MAX_AM & MAX_AM_LIST set(_max_LIBINT_MAX_AM ${LIBINT_MAX_AM}) else() - set(_given_max_am_list FALSE) - set(_max_am_default ${WITH_MAX_AM}) - set(LIBINT_MAX_AM_LIST "") set(LIBINT_MAX_AM ${WITH_MAX_AM}) - set(_max_LIBINT_MAX_AM ${LIBINT_MAX_AM}) +endif() - if (LIBINT_MAX_AM GREATER_EQUAL 8) - message(FATAL "LIBINT_MAX_AM=${LIBINT_MAX_AM} is greater than 8. Are you sure you know what you are doing?") - elseif (LIBINT_MAX_AM LESS_EQUAL 0) - message(FATAL "Invalid value for LIBINT_MAX_AM (${LIBINT_MAX_AM}).") +foreach(_d RANGE 0 ${_max_deriv}) + if (${_d} LESS _ntokens_maxam) + list(GET WITH_MAX_AM ${_d} _candidate0_d${_d}) + else() + set(_candidate0_d${_d} "-1") endif() + message(VERBOSE "setting _candidate0_d${_d}=${_candidate0_d${_d}}") +endforeach() + +if (LIBINT_MAX_AM GREATER_EQUAL 8) + message(FATAL_ERROR "LIBINT_MAX_AM=${LIBINT_MAX_AM} is greater than 8. Are you sure you know what you are doing?") +elseif (LIBINT_MAX_AM LESS_EQUAL 0) + message(FATAL_ERROR "Invalid value for LIBINT_MAX_AM (${LIBINT_MAX_AM}).") endif() -message(STATUS "LIBINT_MAX_AM_LIST=${LIBINT_MAX_AM_LIST} LIBINT_MAX_AM=${LIBINT_MAX_AM}") +message(STATUS "Preparing generic LIBINT_MAX_AM_LIST ${LIBINT_MAX_AM_LIST} and LIBINT_MAX_AM ${LIBINT_MAX_AM} for integrals class defaults.") + +# <<< overall opt_am defaults >>> -list(LENGTH WITH_OPT_AM _ntokens) -if (_ntokens GREATER 1) - set(_max_am 0) - set(PROCESSED_OPT_AM_LIST ) - math(EXPR _max_deriv "${_ntokens} - 1") - foreach(_d RANGE 0 ${_max_deriv}) +list(LENGTH WITH_OPT_AM _ntokens_optam) +if (NOT WITH_OPT_AM EQUAL -1) + if (NOT _ntokens_optam EQUAL _ntokens_maxam) + # discard two cases: scalar opt and list max -and- list opt and scalar max + message(FATAL_ERROR "Invalid format for WITH_OPT_AM (${WITH_OPT_AM}). Use the same format and length like `N` or `N0;N1;N2` as WITH_MAX_AM (${WITH_MAX_AM}).") + endif() +endif() +if (_ntokens_optam GREATER 1) + # list opt and list max: use list opt validating aginst max + set(_processed_OPT_AM_LIST ) + math(EXPR _range_limit "${_ntokens_maxam} - 1") + foreach(_d RANGE ${_range_limit}) + list(GET WITH_MAX_AM ${_d} _max_am) list(GET WITH_OPT_AM ${_d} _opt_am) - if (_opt_am GREATER _max_opt_am) - set(_max_opt_am ${_opt_am}) - endif() - if (_have_max_am_list) - list(GET WITH_MAX_AM ${_d} _max_am) - if (_opt_am GREATER _max_am) - list(APPEND PROCESSED_OPT_AM_LIST ${_max_am}) - else() - list(APPEND PROCESSED_OPT_AM_LIST ${_opt_am}) - endif() + if (_opt_am LESS_EQUAL _max_am) + list(APPEND _processed_OPT_AM_LIST ${_opt_am}) else() - if (_opt_am GREATER LIBINT_MAX_AM) - list(APPEND PROCESSED_OPT_AM_LIST ${LIBINT_MAX_AM}) - else() - list(APPEND PROCESSED_OPT_AM_LIST ${LIBINT_MAX_AM}) - endif() + list(APPEND _processed_OPT_AM_LIST ${_max_am}) endif() - endforeach() - list(JOIN PROCESSED_OPT_AM_LIST "," _sam) - set(LIBINT_OPT_AM_LIST ${_sam}) - set(LIBINT_OPT_AM ${_max_opt_am}) # only overall LIBINT, not specific integrals classes, sets both OPT_AM & OPT_AM_LIST + + list(JOIN _processed_OPT_AM_LIST "," LIBINT_OPT_AM_LIST) + numerical_max_of_list(LIBINT_OPT_AM "${_processed_OPT_AM_LIST}") else() - set(LIBINT_OPT_AM_LIST "") - message(STATUS "WITH_OPT_AM=${WITH_OPT_AM}") - message(STATUS "_max_LIBINT_MAX_AM=${_max_LIBINT_MAX_AM}") - if (WITH_OPT_AM EQUAL -1) - math(EXPR LIBINT_OPT_AM "${_max_LIBINT_MAX_AM}/2 + 1") - #math(EXPR LIBINT_OPT_AM "${_max_LIBINT_MAX_AM}/2 + ${_max_LIBINT_MAX_AM}%2") + if(WITH_OPT_AM EQUAL -1) + if (_ntokens_maxam GREATER 1) + # no opt and list max: default list opt from max + set(_processed_OPT_AM_LIST ) + math(EXPR _range_limit "${_ntokens_maxam} - 1") + foreach(_d RANGE ${_range_limit}) + list(GET WITH_MAX_AM ${_d} _max_am) + math(EXPR _opt_am "${_max_am}/2 + 1") + list(APPEND _processed_OPT_AM_LIST ${_opt_am}) + endforeach() + + list(JOIN _processed_OPT_AM_LIST "," LIBINT_OPT_AM_LIST) + numerical_max_of_list(LIBINT_OPT_AM "${_processed_OPT_AM_LIST}") + else() + # no opt and scalar max: default scalar opt from max + set(LIBINT_OPT_AM_LIST "") + math(EXPR LIBINT_OPT_AM "${LIBINT_MAX_AM}/2 + 1") + endif() else() + # scalar opt and scalar max: use scalar opt validating aginst max + set(LIBINT_OPT_AM_LIST "") set(LIBINT_OPT_AM ${WITH_OPT_AM}) - endif() - if (LIBINT_OPT_AM GREATER _max_LIBINT_MAX_AM) - set(LIBINT_OPT_AM ${_max_LIBINT_MAX_AM}) + if (LIBINT_OPT_AM GREATER LIBINT_MAX_AM) + set(LIBINT_OPT_AM ${LIBINT_MAX_AM}) + endif() endif() endif() -message(STATUS "LIBINT_OPT_AM_LIST=${LIBINT_OPT_AM_LIST} LIBINT_OPT_AM=${LIBINT_OPT_AM}") +message(STATUS "Preparing generic LIBINT_OPT_AM_LIST ${LIBINT_OPT_AM_LIST} and LIBINT_OPT_AM ${LIBINT_OPT_AM} for integrals class defaults.") # <<< Macro >>> macro(process_integrals_class class) + + list(LENGTH ENABLE_${class} _ntokens) + if (NOT _ntokens EQUAL 1) + message(FATAL_ERROR "Invalid value for ENABLE_${class} (${ENABLE_${class}}). Use scalar of maximum derivative level, not list.") + endif() + if (ENABLE_${class} GREATER_EQUAL 0) set(INCLUDE_${class} ${ENABLE_${class}}) + + foreach(_d RANGE 0 ${_max_deriv}) + if (${_d} LESS_EQUAL ${INCLUDE_${class}}) + set(_candidate0_${class}_d${_d} ${_candidate0_d${_d}}) + message(VERBOSE "setting _candidate0_${class}_d${_d}=${_candidate0_${class}_d${_d}}") + endif() + endforeach() + set(LIBINT_SUPPORTS_${class} yes) set(LIBINT_${class}_DERIV ${INCLUDE_${class}}) message(STATUS "Enabling integrals class ${class} to derivative ${INCLUDE_${class}}") @@ -115,60 +156,70 @@ macro(process_integrals_class class) if (ENABLE_${class} GREATER_EQUAL 0) list(LENGTH WITH_${class}_MAX_AM _ntokens) if (_ntokens GREATER 1) - math(EXPR _max_deriv "${_ntokens} - 1") - foreach(_d RANGE 0 ${_max_deriv}) - list(GET WITH_${class}_MAX_AM _d _max_am_${class}_d${_d}) + math(EXPR _ntokens_xptd_max_deriv "${INCLUDE_${class}} + 1") + if (NOT _ntokens_xptd_max_deriv EQUAL _ntokens) + message(FATAL_ERROR "Invalid value for WITH_${class}_MAX_AM (${WITH_${class}_MAX_AM}). ENABLE_${class} derivative (${INCLUDE_${class}}) requires list length ${_ntokens_xptd_max_deriv}, not ${_ntokens}.") + endif() + + foreach(_d RANGE ${INCLUDE_${class}}) + list(GET WITH_${class}_MAX_AM ${_d} _candidate_${class}_d${_d}) + message(VERBOSE "setting _candidate_${class}_d${_d}=${_candidate_${class}_d${_d}}") + + if (_candidate_${class}_d${_d} GREATER LIBINT_MAX_AM) + message(FATAL_ERROR "Invalid value for WITH_${class}_MAX_AM derivative element ${_d} (${_candidate_${class}_d${_d}} > ${LIBINT_MAX_AM}).") + # note this check is necessary but insufficient since per-d max may be available from LIBINT_MAX_AM_LIST. + # suggest requiring all WITH_*_AM options to be either `N` or `N0;N1;N2` format for cleaner validation. + elseif (_candidate_${class}_d${_d} LESS_EQUAL 0) + message(FATAL_ERROR "Invalid value for WITH_${class}_MAX_AM derivative element ${_d} (${_candidate_${class}_d${_d}} <= 0).") + endif() endforeach() - list(JOIN WITH_${class}_MAX_AM "," _sam) - set(${class}_MAX_AM_LIST ${_sam}) + list(JOIN WITH_${class}_MAX_AM "," ${class}_MAX_AM_LIST) set(${class}_MAX_AM "") else() set(${class}_MAX_AM_LIST "") if (WITH_${class}_MAX_AM EQUAL -1) - - foreach(_d RANGE 0 ${INCLUDE_${class}}) - if (DEFINED _max_am_default_d${_d}) - set(_candidate_max_am_${class}_d${_d} ${_max_am_default_d${_d}}) + foreach(_d RANGE ${INCLUDE_${class}}) + if (${_candidate0_${class}_d${_d}} EQUAL -1) + set(_candidate_${class}_d${_d} ${_candidate0_${class}_d0}) else() - set(_candidate_max_am_${class}_d${_d} ${_max_am_default}) + set(_candidate_${class}_d${_d} ${_candidate0_${class}_d${_d}}) endif() + message(VERBOSE "setting _candidate_${class}_d${_d}=${_candidate_${class}_d${_d}}") endforeach() - if (${INCLUDE_${class}} GREATER_EQUAL 0) - set(${class}_MAX_AM ${LIBINT_MAX_AM}) - else() - set(${class}_MAX_AM "") - endif() - set(_max_${class}_MAX_AM ${LIBINT_MAX_AM}) + set(${class}_MAX_AM "") + # note: could set class_MAX_AM/LIST from default (in configure.ac, looks like at least scalar var set) + # but philosophy is to set user-only intent and leave further defaulting to compiled code. wrong? else() - # _max_* variable in case want to default opt_am from it some day set(${class}_MAX_AM ${WITH_${class}_MAX_AM}) - set(_max_${class}_MAX_AM ${${class}_MAX_AM}) - set(_candidate_${class}_E ${${class}_MAX_AM}) - if (${INCLUDE_${class}} GREATER_EQUAL 1) - set(_candidate_${class}_G ${${class}_MAX_AM}) - endif() - if (${INCLUDE_${class}} GREATER_EQUAL 2) - set(_candidate_${class}_H ${${class}_MAX_AM}) - endif() + foreach(_d RANGE ${INCLUDE_${class}}) + set(_candidate_${class}_d${_d} ${${class}_MAX_AM}) + message(VERBOSE "setting _candidate_${class}_d${_d}=${_candidate_${class}_d${_d}}") + endforeach() if (${class}_MAX_AM GREATER_EQUAL 8) - message(FATAL "Value for ${class}_MAX_AM too high (${${class}_MAX_AM}). Are you sure you know what you are doing?") + message(FATAL_ERROR "Value for ${class}_MAX_AM too high (${${class}_MAX_AM} >= 8). Are you sure you know what you are doing?") elseif (${class}_MAX_AM LESS_EQUAL 0) - message(FATAL "Invalid value for ${class}_MAX_AM (${${class}_MAX_AM}).") + message(FATAL_ERROR "Invalid value for ${class}_MAX_AM (${${class}_MAX_AM} <= 0).") endif() endif() endif() - message(STATUS "Enabling integrals class ${class} to max AM ${${class}_MAX_AM}${${class}_MAX_AM_LIST} (else ${LIBINT_MAX_AM}${LIBINT_MAX_AM_LIST})") - - list(LENGTH WITH_${class}_OPT_AM _lam) - if (_lam GREATER 1) - list(JOIN WITH_${class}_OPT_AM "," _sam) - execute_process (COMMAND bash -c "echo ${_sam} | tr , '\n' | sort -n | tail -n1" - OUTPUT_VARIABLE _max_${class}_OPT_AM) - set(${class}_OPT_AM_LIST ${_sam}) + if (LIBINT_MAX_AM_LIST) + set(_msg ${LIBINT_MAX_AM_LIST}) + else() + set(_msg ${LIBINT_MAX_AM}) + endif() + message(STATUS "Enabling integrals class ${class} to max AM ${${class}_MAX_AM}${${class}_MAX_AM_LIST} (else ${_msg})") + + list(LENGTH WITH_${class}_OPT_AM _ntokens) + if (_ntokens GREATER 1) + if (NOT _ntokens_xptd_max_deriv EQUAL _ntokens) + message(FATAL_ERROR "Invalid value for WITH_${class}_OPT_AM (${WITH_${class}_OPT_AM}). ENABLE_${class} derivative (${INCLUDE_${class}}) requires list length ${_ntokens_xptd_max_deriv}, not ${_ntokens}.") + endif() + + list(JOIN WITH_${class}_OPT_AM "," ${class}_OPT_AM_LIST) set(${class}_OPT_AM "") else() set(${class}_OPT_AM_LIST "") @@ -176,38 +227,137 @@ macro(process_integrals_class class) set(${class}_OPT_AM "") else() set(${class}_OPT_AM ${WITH_${class}_OPT_AM}) + endif() + endif() + if (LIBINT_OPT_AM_LIST) + set(_msg ${LIBINT_OPT_AM_LIST}) + else() + set(_msg ${LIBINT_OPT_AM}) + endif() + message(STATUS "Enabling integrals class ${class} to opt AM ${${class}_OPT_AM}${${class}_OPT_AM_LIST} (else ${_msg})") + endif() +endmacro() + + +macro(process_integrals_class_alt class) + + list(LENGTH ENABLE_${class} _ntokens) + if (NOT _ntokens EQUAL 1) + message(FATAL_ERROR "Invalid value for ENABLE_${class} (${ENABLE_${class}}). Use scalar of maximum derivative level, not list.") + endif() + + if (ENABLE_${class} GREATER_EQUAL 0) + set(INCLUDE_${class} ${ENABLE_${class}}) + + foreach(_d RANGE 0 ${_max_deriv}) + if (${_d} LESS_EQUAL ${INCLUDE_${class}}) + # no per-d defaults. use energy + set(_candidate0_${class}_d${_d} ${_candidate0_d0}) + message(VERBOSE "setting _candidate0_${class}_d${_d}=${_candidate0_${class}_d${_d}}") + endif() + endforeach() + + set(LIBINT_SUPPORTS_${class} yes) + set(LIBINT_${class}_DERIV ${INCLUDE_${class}}) + message(STATUS "Enabling integrals class ${class} to derivative ${INCLUDE_${class}}") + else() + set(INCLUDE_${class} "-1") + set(${class}_MAX_AM "") + message(STATUS "Disabling integrals class ${class}") + endif() + + if (ENABLE_${class} GREATER_EQUAL 0) + list(LENGTH WITH_${class}_MAX_AM _ntokens) + if (_ntokens GREATER 1) + message(FATAL_ERROR "Invalid value for WITH_${class}_MAX_AM (${WITH_${class}_MAX_AM}). ENABLE_${class} derivative supports only scalar, not list length ${_ntokens}.") + + else() + if (WITH_${class}_MAX_AM EQUAL -1) + foreach(_d RANGE ${INCLUDE_${class}}) + set(_candidate_${class}_d${_d} ${_candidate0_${class}_d0}) + message(VERBOSE "setting _candidate_${class}_d${_d}=${_candidate_${class}_d0}") + endforeach() + + set(_${class}_MAX_AM_pre "") + set(${class}_MAX_AM ${_candidate0_${class}_d0}) + # note: unlike usual classes, C++ code seems to want class_MAX_AM set explicitly to config.h + else() + set(_${class}_MAX_AM_pre ${WITH_${class}_MAX_AM}) + set(${class}_MAX_AM ${WITH_${class}_MAX_AM}) + + foreach(_d RANGE ${INCLUDE_${class}}) + set(_candidate_${class}_d${_d} ${${class}_MAX_AM}) + message(VERBOSE "setting _candidate_${class}_d${_d}=${_candidate_${class}_d${_d}}") + endforeach() - if (${class}_OPT_AM GREATER _max_${class}_MAX_AM) - message(FATAL "Invalid value for ${class}_OPT_AM (${${class}_OPT_AM} !<= ${_max_${class}_MAX_AM}).") + if (${class}_MAX_AM GREATER_EQUAL 8) + message(FATAL_ERROR "Value for ${class}_MAX_AM too high (${${class}_MAX_AM} >= 8). Are you sure you know what you are doing?") + elseif (${class}_MAX_AM LESS_EQUAL 0) + message(FATAL_ERROR "Invalid value for ${class}_MAX_AM (${${class}_MAX_AM} <= 0).") endif() endif() + endif() + message(STATUS "Enabling integrals class ${class} to max AM ${_${class}_MAX_AM_pre} (else ${LIBINT_MAX_AM})") + list(LENGTH WITH_${class}_OPT_AM _ntokens) + if (_ntokens GREATER 1) + message(FATAL_ERROR "Invalid value for WITH_${class}_OPT_AM (${WITH_${class}_OPT_AM}). ENABLE_${class} derivative supports only scalar, not list length ${_ntokens}.") + + else() + if (WITH_${class}_OPT_AM EQUAL -1) + set(_${class}_OPT_AM_pre "") + set(${class}_OPT_AM ${LIBINT_OPT_AM}) + # note: unlike usual classes, C++ code seems to want class_MAX_AM set explicitly + else() + set(_${class}_OPT_AM_pre ${WITH_${class}_OPT_AM}) + set(${class}_OPT_AM ${WITH_${class}_OPT_AM}) + endif() endif() - message(STATUS "Enabling integrals class ${class} to opt AM ${${class}_OPT_AM}${${class}_OPT_AM_LIST} (else ${LIBINT_OPT_AM}${LIBINT_OPT_AM_LIST})") + message(STATUS "Enabling integrals class ${class} to opt AM ${_${class}_OPT_AM_pre} (else ${LIBINT_OPT_AM})") endif() endmacro() process_integrals_class(ONEBODY) -process_integrals_class(ERI2) -process_integrals_class(ERI3) process_integrals_class(ERI) +process_integrals_class(ERI3) +process_integrals_class(ERI2) +# unlike above, these classes (1) don't do AM_LIST and (2) require value in config.h if enabled +process_integrals_class_alt(G12) +process_integrals_class_alt(G12DKH) -# discrepancy, as configure doesn't do AM_LIST for these -process_integrals_class(G12) -process_integrals_class(G12DKH) +if (ENABLE_G12 GREATER_EQUAL 0) + set(SUPPORT_T1G12 ${ENABLE_T1G12_SUPPORT}) +else() + set(SUPPORT_T1G12 OFF) +endif() -# form list of active _ strings to use in Libint2Config + +# form list of active class + deriv + max_am strings to use in libint2-config.cmake set(Libint2_ERI_COMPONENTS "") -foreach(_cls ERI2;ERI3;ERI4) - string(TOLOWER ${_cls} _lbl) - set(_lbl "${_lbl}_") +foreach(_cls ERI;ERI3;ERI2;ONEBODY;G12;G12DKH) + if (_cls STREQUAL "ERI") + set(_lbl "eri_c4") + elseif (_cls STREQUAL "ERI3") + set(_lbl "eri_c3") + elseif (_cls STREQUAL "ERI2") + set(_lbl "eri_c2") + elseif (_cls STREQUAL "ONEBODY") + set(_lbl "onebody") + elseif (_cls STREQUAL "G12") + set(_lbl "g12") + elseif (_cls STREQUAL "G12DKH") + set(_lbl "g12dkh") + endif() - foreach (_deriv RANGE 0 ${INCLUDE_${_cls}}) - foreach(_l RANGE 0 ${_max_am_${_cls}_d${_deriv}}) - list(APPEND Libint2_ERI_COMPONENTS "${_lbl}_d${_deriv}_l${_l}") + if (INCLUDE_${_cls} GREATER -1) + foreach (_d RANGE 0 ${INCLUDE_${_cls}}) + foreach(_l RANGE 2 ${_candidate_${_cls}_d${_d}}) + list(APPEND Libint2_ERI_COMPONENTS "${_lbl}_d${_d}_l${_l}") + message(VERBOSE "setting component ${_lbl}_d${_d}_l${_l}") + endforeach() endforeach() - endforeach() + endif() endforeach() message(STATUS "Library will satisfy ERI AM components: ${Libint2_ERI_COMPONENTS}") diff --git a/cmake/modules/int_computed.cmake.in b/cmake/modules/int_computed.cmake.in index 00f31387e..c59492914 100644 --- a/cmake/modules/int_computed.cmake.in +++ b/cmake/modules/int_computed.cmake.in @@ -10,14 +10,14 @@ set(LIBINT_MAJOR_VERSION "@LIBINT_MAJOR_VERSION@") set(LIBINT_MINOR_VERSION "@LIBINT_MINOR_VERSION@") set(LIBINT_MICRO_VERSION "@LIBINT_MICRO_VERSION@") -set(Libint2_VERSION ${LIBINT_MAJOR_VERSION}.${LIBINT_MINOR_VERSION}.${LIBINT_MICRO_VERSION}) +set(LIBINT_VERSION ${LIBINT_MAJOR_VERSION}.${LIBINT_MINOR_VERSION}.${LIBINT_MICRO_VERSION}) # <<< Dev Version >>> -set(LIBINT_TWEAK_VERSION "@LIBINT_TWEAK_VERSION@") -set(LIBINT_VERSION ${Libint2_VERSION}-${LIBINT_TWEAK_VERSION}) -message(STATUS "Version: Full ${LIBINT_VERSION} Numeric ${Libint2_VERSION}") +set(LIBINT_BUILDID "@LIBINT_BUILDID@") +set(LIBINT_EXT_VERSION "@LIBINT_EXT_VERSION@") +message(STATUS "Version: Full ${LIBINT_EXT_VERSION} Numeric ${LIBINT_VERSION}") # <<< ABI Version >>> @@ -31,20 +31,16 @@ math(EXPR LIBINT_MAJOR_SOVERSION "${LIBINT_CURRENT_SOVERSION} - ${LIBINT_AGE_SOV message(STATUS "SO Version: Full ${LIBINT_SOVERSION} Major ${LIBINT_MAJOR_SOVERSION}") -# <<< Legacy Libtool >>> - -set(LIBINT_BUILDID ${LIBINT_TWEAK_VERSION}) -set(LIBINT_MMM_VERSION ${Libint2_VERSION}) -set(LIBINT_SO_VERSION ${LIBINT_SOVERSION}) - - # <<< Fixed Orderings >>> set(LIBINT2_CARTGAUSS_ORDERING "@LIBINT2_CARTGAUSS_ORDERING@") set(LIBINT2_SHELL_SET "@LIBINT2_SHELL_SET@") +set(ERI3_PURE_SH "@ERI3_PURE_SH@") +set(ERI2_PURE_SH "@ERI2_PURE_SH@") # <<< AM Components >>> -set(Libint2_ERI_COMPONENTS "@Libint2_ERI_COMPONENTS@") -set(Libint2_MAX_AM_ERI "@_candidate_ERI_E@") +set(Libint2_ERI_COMPONENTS "@Libint2_ERI_COMPONENTS@") # for CMake config file +set(Libint2_MAX_AM_ERI "@_candidate_ERI_d0@") # for CMake config file +set(Libint2_ERI_MAX_AM "@_candidate_ERI_d0@") # for features file diff --git a/cmake/modules/int_orderings.cmake b/cmake/modules/int_orderings.cmake index 7001fcb2b..e7df4675f 100644 --- a/cmake/modules/int_orderings.cmake +++ b/cmake/modules/int_orderings.cmake @@ -14,7 +14,7 @@ if (LIBINT2_SHGAUSS_ORDERING STREQUAL "standard") elseif (LIBINT2_SHGAUSS_ORDERING STREQUAL "gaussian") set(LIBINT_SHGSHELL_ORDERING ${LIBINT_SHGSHELL_ORDERING_GAUSSIAN}) else() - message(FATAL "Invalid value for LIBINT2_SHGAUSS_ORDERING (${LIBINT2_SHGAUSS_ORDERING})") + message(FATAL_ERROR "Invalid value for LIBINT2_SHGAUSS_ORDERING (${LIBINT2_SHGAUSS_ORDERING})") endif() @@ -37,7 +37,7 @@ elseif (LIBINT2_CARTGAUSS_ORDERING STREQUAL "orca") elseif (LIBINT2_CARTGAUSS_ORDERING STREQUAL "bagel") set(LIBINT_CGSHELL_ORDERING ${LIBINT_CGSHELL_ORDERING_BAGEL}) else() - message(FATAL "Invalid value for LIBINT2_CARTGAUSS_ORDERING (${LIBINT2_CARTGAUSS_ORDERING})") + message(FATAL_ERROR "Invalid value for LIBINT2_CARTGAUSS_ORDERING (${LIBINT2_CARTGAUSS_ORDERING})") endif() @@ -51,5 +51,5 @@ if (LIBINT2_SHELL_SET STREQUAL "standard") elseif (LIBINT2_SHELL_SET STREQUAL "orca") set(LIBINT_SHELL_SET ${LIBINT_SHELL_SET_ORCA}) else() - message(FATAL "Invalid value for LIBINT2_SHELL_SET (${LIBINT2_SHELL_SET})") + message(FATAL_ERROR "Invalid value for LIBINT2_SHELL_SET (${LIBINT2_SHELL_SET})") endif() diff --git a/cmake/modules/int_versions.cmake b/cmake/modules/int_versions.cmake index c9dffaf11..68fb1c421 100644 --- a/cmake/modules/int_versions.cmake +++ b/cmake/modules/int_versions.cmake @@ -1,47 +1,38 @@ -# Keep libtool and cmake in sync by collecting versions from configure.ac -# If CMake becomes primary buildsys, define as `project(..., VERSION)` +# top-level CMakeLists.txt has defined: +# * PROJECT_VERSION_{MAJOR|MINOR|PATCH} through `project(... VERSION)` +# * LIBINT_BUILDID +# * LIBINT_SOVERSION + +# note that 3rd version integer is PATCH in CMake and MICRO in Libint + # <<< Build Version >>> -file(STRINGS "configure.ac" _libint_configure_ac - REGEX "libint_mmm_version") -foreach(ver ${_libint_configure_ac}) - if (ver MATCHES "^define..libint_mmm_version...([0-9]+).([0-9]+).([0-9]+)..$") - set(LIBINT_MAJOR_VERSION ${CMAKE_MATCH_1}) - set(LIBINT_MINOR_VERSION ${CMAKE_MATCH_2}) - set(LIBINT_MICRO_VERSION ${CMAKE_MATCH_3}) - endif() -endforeach() +set(LIBINT_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}) +set(LIBINT_MINOR_VERSION ${PROJECT_VERSION_MINOR}) +set(LIBINT_MICRO_VERSION ${PROJECT_VERSION_PATCH}) -set(Libint2_VERSION ${LIBINT_MAJOR_VERSION}.${LIBINT_MINOR_VERSION}.${LIBINT_MICRO_VERSION}) +set(LIBINT_VERSION ${LIBINT_MAJOR_VERSION}.${LIBINT_MINOR_VERSION}.${LIBINT_MICRO_VERSION}) # <<< Dev Version >>> -file(STRINGS "configure.ac" _libint_configure_ac - REGEX "libint_buildid") -foreach(ver ${_libint_configure_ac}) - if (ver MATCHES "^define..libint_buildid...([a-z0-9.]+)..$") - set(LIBINT_TWEAK_VERSION ${CMAKE_MATCH_1}) - endif() -endforeach() +if (LIBINT_BUILDID) + set(LIBINT_EXT_VERSION ${LIBINT_VERSION}-${LIBINT_BUILDID}) +else() + set(LIBINT_EXT_VERSION ${LIBINT_VERSION}) +endif() -set(LIBINT_VERSION ${Libint2_VERSION}-${LIBINT_TWEAK_VERSION}) -message(STATUS "Version: Full ${LIBINT_VERSION} Numeric ${Libint2_VERSION}") +message(STATUS "Version: Full ${LIBINT_EXT_VERSION} Numeric ${LIBINT_VERSION}") # <<< ABI Version >>> -file(STRINGS "configure.ac" _libint_configure_ac - REGEX "libint_so_version") -foreach(ver ${_libint_configure_ac}) - if (ver MATCHES "^define..libint_so_version...([0-9]+).([0-9]+).([0-9]+)..$") - set(LIBINT_CURRENT_SOVERSION ${CMAKE_MATCH_1}) - set(LIBINT_REVISION_SOVERSION ${CMAKE_MATCH_2}) - set(LIBINT_AGE_SOVERSION ${CMAKE_MATCH_3}) - endif() -endforeach() - -set(LIBINT_SOVERSION ${LIBINT_CURRENT_SOVERSION}:${LIBINT_REVISION_SOVERSION}:${LIBINT_AGE_SOVERSION}) +string(REPLACE ":" ";" LIBINT_SOVERSION_LIST ${LIBINT_SOVERSION}) + +list(GET LIBINT_SOVERSION_LIST 0 LIBINT_CURRENT_SOVERSION) +list(GET LIBINT_SOVERSION_LIST 1 LIBINT_REVISION_SOVERSION) +list(GET LIBINT_SOVERSION_LIST 2 LIBINT_AGE_SOVERSION) + math(EXPR LIBINT_MAJOR_SOVERSION "${LIBINT_CURRENT_SOVERSION} - ${LIBINT_AGE_SOVERSION}") message(STATUS "SO Version: Full ${LIBINT_SOVERSION} Major ${LIBINT_MAJOR_SOVERSION}") diff --git a/cmake/modules/xhost.cmake b/cmake/modules/xhost.cmake new file mode 100644 index 000000000..9118c0559 --- /dev/null +++ b/cmake/modules/xhost.cmake @@ -0,0 +1,23 @@ +# Need to check things per compiler brand since they're different +if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + option_with_flags(ENABLE_XHOST "Enable processor-specific optimization" ON "-xHost") +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + option_with_flags(ENABLE_XHOST "Enable processor-specific optimization" ON "-march=native") +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC") + # clang-cl + option_with_flags(ENABLE_XHOST "Enable processor-specific optimization" ON "/arch:AVX2") + elseif (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU") + if (NOT CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64") + option_with_flags(ENABLE_XHOST "Enable processor-specific optimization" ON "-march=native") + endif() + endif() +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + option_with_flags(ENABLE_XHOST "Enable processor-specific optimization" ON "-march=native") +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") + option_with_flags(ENABLE_XHOST "Enable processor-specific optimization" ON "-tp host") +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + option_with_flags(ENABLE_XHOST "Enable processor-specific optimization" ON "/arch:AVX2") +endif() +# IntelLLVM + diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 000000000..c6cbe5926 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(classdoc) diff --git a/doc/classdoc/CMakeLists.txt b/doc/classdoc/CMakeLists.txt new file mode 100644 index 000000000..17ca980a8 --- /dev/null +++ b/doc/classdoc/CMakeLists.txt @@ -0,0 +1,20 @@ +find_package(Doxygen) # QUIET) +if(NOT DOXYGEN_FOUND) + message(STATUS "No Doxygen, no docs.") +else() + message(STATUS "Documentation targets available: doxyman (html)") + + # Configuration of the Doxygen configuration file + set(HAVE_QHELP "NO") + set(QHELP_GENERATOR "") + set(HAVE_DOT "NO") + set(DOT_PATH "") + configure_file(doxygen.cfg.in doxygen.cfg @ONLY) + + add_custom_target( + doxyman + VERBATIM + COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg + COMMENT "Build Doxygen html documentation ..." + ) +endif() diff --git a/include/libint2/basis.h.in b/include/libint2/basis.h.in index bfe65df77..6c15714c2 100644 --- a/include/libint2/basis.h.in +++ b/include/libint2/basis.h.in @@ -446,7 +446,12 @@ namespace libint2 { static std::vector> read_g94_basis_library(std::string file_dot_g94, bool force_cartesian_d = false, bool throw_if_missing = true, - std::string locale_name = std::string("POSIX")) { +#ifdef _MSC_VER + std::string locale_name = std::string("en-US") +#else + std::string locale_name = std::string("POSIX") // "en_US" +#endif + ) { std::locale locale(locale_name.c_str()); // TODO omit c_str() with up-to-date stdlib std::vector> ref_shells(118); // 118 = number of chemical elements diff --git a/include/libint2/boys.h b/include/libint2/boys.h index 9508fd874..4c5dbc44d 100644 --- a/include/libint2/boys.h +++ b/include/libint2/boys.h @@ -258,7 +258,7 @@ namespace libint2 { static constexpr int ORDER = interpolation_order; //!, interpolation order static constexpr int ORDERp1 = ORDER+1; //!< ORDER + 1 - static constexpr Real T_crit = cheb_table_tmax; //!< critical value of T above which safe to use upward recusion + static constexpr Real T_crit = cheb_table_tmax; //!< critical value of T above which safe to use upward recursion static constexpr Real delta = cheb_table_delta; //!< interval size static constexpr Real one_over_delta = 1/delta; //! 1/delta diff --git a/include/libint2/config.h.cmake.in b/include/libint2/config.h.cmake.in index acd00885c..75b6a41cf 100644 --- a/include/libint2/config.h.cmake.in +++ b/include/libint2/config.h.cmake.in @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2020 Edward F. Valeev + * Copyright (C) 2004-2021 Edward F. Valeev * * This file is part of Libint. * @@ -156,7 +156,7 @@ #cmakedefine G12_OPT_AM @G12_OPT_AM@ /* Support [Ti,G12] ? */ -#undef SUPPORT_T1G12 +#cmakedefine01 SUPPORT_T1G12 /* Max AM for G12DKH method integrals */ #cmakedefine G12DKH_MAX_AM @G12DKH_MAX_AM@ diff --git a/include/libint2/config2.h.cmake.in b/include/libint2/config2.h.cmake.in index c9947cc9e..2bd03ca17 100644 --- a/include/libint2/config2.h.cmake.in +++ b/include/libint2/config2.h.cmake.in @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2020 Edward F. Valeev + * Copyright (C) 2004-2021 Edward F. Valeev * * This file is part of Libint. * diff --git a/include/libint2/diis.h b/include/libint2/diis.h index 5e0640971..3d353f2b5 100644 --- a/include/libint2/diis.h +++ b/include/libint2/diis.h @@ -28,11 +28,15 @@ #include +#ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC system_header +#endif #include #include +#ifdef __GNUC__ #pragma GCC diagnostic pop +#endif namespace libint2 { diff --git a/include/libint2/engine.impl.h b/include/libint2/engine.impl.h index a1ee9c1c7..7332154ff 100644 --- a/include/libint2/engine.impl.h +++ b/include/libint2/engine.impl.h @@ -26,10 +26,14 @@ #include +#ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC system_header +#endif #include +#ifdef __GNUC__ #pragma GCC diagnostic pop +#endif #include #if LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS diff --git a/include/libint2/lcao/molden.h b/include/libint2/lcao/molden.h index ee9ec1e8e..0c984dfbf 100644 --- a/include/libint2/lcao/molden.h +++ b/include/libint2/lcao/molden.h @@ -34,10 +34,14 @@ #include #include +#ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC system_header +#endif #include +#ifdef __GNUC__ #pragma GCC diagnostic pop +#endif namespace libint2 { namespace molden { diff --git a/lib/basis/6-31G_d_.g94 b/lib/basis/6-31G_d_.g94 deleted file mode 100644 index 7441a1f7e..000000000 --- a/lib/basis/6-31G_d_.g94 +++ /dev/null @@ -1,804 +0,0 @@ -! 6-31G* EMSL Basis Set Exchange Library 4/12/14 5:25 -! Elements References -! -------- ---------- -! H - He: W.J. Hehre, R. Ditchfield and J.A. Pople, J. Chem. Phys. 56, -! Li - Ne: 2257 (1972). Note: Li and B come from J.D. Dill and J.A. -! Pople, J. Chem. Phys. 62, 2921 (1975). -! Na - Ar: M.M. Francl, W.J. Petro, W.J. Hehre, J.S. Binkley, M.S. Gordon, -! D.J. DeFrees and J.A. Pople, J. Chem. Phys. 77, 3654 (1982) -! K - Zn: V. Rassolov, J.A. Pople, M. Ratner and T.L. Windus, J. Chem. Phys. -! 109, 1223 (1998) -! Note: He and Ne are unpublished basis sets taken from the Gaussian -! program -! - - -! Elements References -! -------- ---------- -! Li - Ne: P.C. Hariharan and J.A. Pople, Theoret. Chimica Acta 28, 213 (1973). -! Na - Ar: M.M. Francl, W.J. Petro, W.J. Hehre, J.S. Binkley, M.S. Gordon, D.J. -! DeFrees and J.A. Pople, J. Chem. Phys. 77, 3654 (1982). -! K - Zn: V. Rassolov, J.A. Pople, M. Ratner and T.L. Windus, J. Chem. Phys. -! 109, 1223 (1998) -! -! Note: He and Ne are unpublished basis sets taken from Gaussian. -! - -**** -H 0 -S 3 1.00 - 18.7311370 0.03349460 - 2.8253937 0.23472695 - 0.6401217 0.81375733 -S 1 1.00 - 0.1612778 1.0000000 -**** -He 0 -S 3 1.00 - 38.4216340 0.0237660 - 5.7780300 0.1546790 - 1.2417740 0.4696300 -S 1 1.00 - 0.2979640 1.0000000 -**** -Li 0 -S 6 1.00 - 642.4189200 0.0021426 - 96.7985150 0.0162089 - 22.0911210 0.0773156 - 6.2010703 0.2457860 - 1.9351177 0.4701890 - 0.6367358 0.3454708 -SP 3 1.00 - 2.3249184 -0.0350917 0.0089415 - 0.6324306 -0.1912328 0.1410095 - 0.0790534 1.0839878 0.9453637 -SP 1 1.00 - 0.0359620 1.0000000 1.0000000 -D 1 1.00 - 0.2000000 1.0000000 -**** -Be 0 -S 6 1.00 - 1264.5857000 0.0019448 - 189.9368100 0.0148351 - 43.1590890 0.0720906 - 12.0986630 0.2371542 - 3.8063232 0.4691987 - 1.2728903 0.3565202 -SP 3 1.00 - 3.1964631 -0.1126487 0.0559802 - 0.7478133 -0.2295064 0.2615506 - 0.2199663 1.1869167 0.7939723 -SP 1 1.00 - 0.0823099 1.0000000 1.0000000 -D 1 1.00 - 0.4000000 1.0000000 -**** -B 0 -S 6 1.00 - 2068.8823000 0.0018663 - 310.6495700 0.0142515 - 70.6830330 0.0695516 - 19.8610800 0.2325729 - 6.2993048 0.4670787 - 2.1270270 0.3634314 -SP 3 1.00 - 4.7279710 -0.1303938 0.0745976 - 1.1903377 -0.1307889 0.3078467 - 0.3594117 1.1309444 0.7434568 -SP 1 1.00 - 0.1267512 1.0000000 1.0000000 -D 1 1.00 - 0.6000000 1.0000000 -**** -C 0 -S 6 1.00 - 3047.5249000 0.0018347 - 457.3695100 0.0140373 - 103.9486900 0.0688426 - 29.2101550 0.2321844 - 9.2866630 0.4679413 - 3.1639270 0.3623120 -SP 3 1.00 - 7.8682724 -0.1193324 0.0689991 - 1.8812885 -0.1608542 0.3164240 - 0.5442493 1.1434564 0.7443083 -SP 1 1.00 - 0.1687144 1.0000000 1.0000000 -D 1 1.00 - 0.8000000 1.0000000 -**** -N 0 -S 6 1.00 - 4173.5110000 0.0018348 - 627.4579000 0.0139950 - 142.9021000 0.0685870 - 40.2343300 0.2322410 - 12.8202100 0.4690700 - 4.3904370 0.3604550 -SP 3 1.00 - 11.6263580 -0.1149610 0.0675800 - 2.7162800 -0.1691180 0.3239070 - 0.7722180 1.1458520 0.7408950 -SP 1 1.00 - 0.2120313 1.0000000 1.0000000 -D 1 1.00 - 0.8000000 1.0000000 -**** -O 0 -S 6 1.00 - 5484.6717000 0.0018311 - 825.2349500 0.0139501 - 188.0469600 0.0684451 - 52.9645000 0.2327143 - 16.8975700 0.4701930 - 5.7996353 0.3585209 -SP 3 1.00 - 15.5396160 -0.1107775 0.0708743 - 3.5999336 -0.1480263 0.3397528 - 1.0137618 1.1307670 0.7271586 -SP 1 1.00 - 0.2700058 1.0000000 1.0000000 -D 1 1.00 - 0.8000000 1.0000000 -**** -F 0 -S 6 1.00 - 7001.7130900 0.0018196169 - 1051.3660900 0.0139160796 - 239.2856900 0.0684053245 - 67.3974453 0.233185760 - 21.5199573 0.471267439 - 7.40310130 0.356618546 -SP 3 1.00 - 20.8479528 -0.108506975 0.0716287243 - 4.80830834 -0.146451658 0.3459121030 - 1.34406986 1.128688580 0.7224699570 -SP 1 1.00 - 0.358151393 1.0000000 1.0000000 -D 1 1.00 - 0.8000000 1.0000000 -**** -Ne 0 -S 6 1.00 - 8425.8515300 0.0018843481 - 1268.5194000 0.0143368994 - 289.6214140 0.0701096233 - 81.8590040 0.2373732660 - 26.2515079 0.4730071260 - 9.09472051 0.3484012410 -SP 3 1.00 - 26.5321310 -0.107118287 0.0719095885 - 6.10175501 -0.146163821 0.3495133720 - 1.69627153 1.127773500 0.7199405120 -SP 1 1.00 - 0.44581870 1.0000000 1.0000000 -D 1 1.00 - 0.8000000 1.0000000 -**** -Na 0 -S 6 1.00 - 9993.2000000 0.0019377 - 1499.8900000 0.0148070 - 341.9510000 0.0727060 - 94.6797000 0.2526290 - 29.7345000 0.4932420 - 10.0063000 0.3131690 -SP 6 1.00 - 150.9630000 -0.0035421 0.0050017 - 35.5878000 -0.0439590 0.0355110 - 11.1683000 -0.1097521 0.1428250 - 3.9020100 0.1873980 0.3386200 - 1.3817700 0.6466990 0.4515790 - 0.4663820 0.3060580 0.2732710 -SP 3 1.00 - 0.4979660 -0.2485030 -0.0230230 - 0.0843530 -0.1317040 0.9503590 - 0.0666350 1.2335200 0.0598580 -SP 1 1.00 - 0.0259544 1.0000000 1.0000000 -D 1 1.00 - 0.1750000 1.0000000 -**** -Mg 0 -S 6 1.00 - 11722.8000000 0.0019778 - 1759.9300000 0.0151140 - 400.8460000 0.0739110 - 112.8070000 0.2491910 - 35.9997000 0.4879280 - 12.1828000 0.3196620 -SP 6 1.00 - 189.1800000 -0.0032372 0.0049281 - 45.2119000 -0.0410080 0.0349890 - 14.3563000 -0.1126000 0.1407250 - 5.1388600 0.1486330 0.3336420 - 1.9065200 0.6164970 0.4449400 - 0.7058870 0.3648290 0.2692540 -SP 3 1.00 - 0.9293400 -0.2122900 -0.0224190 - 0.2690350 -0.1079850 0.1922700 - 0.1173790 1.1758400 0.8461810 -SP 1 1.00 - 0.0421061 1.0000000 1.0000000 -D 1 1.00 - 0.1750000 1.0000000 -**** -Al 0 -S 6 1.00 - 13983.1000000 0.00194267 - 2098.7500000 0.0148599 - 477.7050000 0.0728494 - 134.3600000 0.2468300 - 42.8709000 0.4872580 - 14.5189000 0.3234960 -SP 6 1.00 - 239.6680000 -0.00292619 0.00460285 - 57.4419000 -0.0374080 0.0331990 - 18.2859000 -0.1144870 0.1362820 - 6.5991400 0.1156350 0.3304760 - 2.4904900 0.6125950 0.4491460 - 0.9445400 0.3937990 0.2657040 -SP 3 1.00 - 1.2779000 -0.2276060 -0.0175130 - 0.3975900 0.00144583 0.2445330 - 0.1600950 1.0927900 0.8049340 -SP 1 1.00 - 0.0556577 1.0000000 1.0000000 -D 1 1.00 - 0.3250000 1.0000000 -**** -Si 0 -S 6 1.00 - 16115.9000000 0.00195948 - 2425.5800000 0.01492880 - 553.8670000 0.07284780 - 156.3400000 0.24613000 - 50.0683000 0.48591400 - 17.0178000 0.32500200 -SP 6 1.00 - 292.7180000 -0.00278094 0.00443826 - 69.8731000 -0.03571460 0.03266790 - 22.3363000 -0.11498500 0.13472100 - 8.1503900 0.09356340 0.32867800 - 3.1345800 0.60301700 0.44964000 - 1.2254300 0.41895900 0.26137200 -SP 3 1.00 - 1.7273800 -0.24463000 -0.01779510 - 0.5729220 0.00431572 0.25353900 - 0.2221920 1.09818000 0.80066900 -SP 1 1.00 - 0.0778369 1.00000000 1.00000000 -D 1 1.00 - 0.4500000 1.0000000 -**** -P 0 -S 6 1.00 - 19413.3000000 0.0018516 - 2909.4200000 0.0142062 - 661.3640000 0.0699995 - 185.7590000 0.2400790 - 59.1943000 0.4847620 - 20.0310000 0.3352000 -SP 6 1.00 - 339.4780000 -0.00278217 0.00456462 - 81.0101000 -0.0360499 0.03369360 - 25.8780000 -0.1166310 0.13975500 - 9.4522100 0.0968328 0.33936200 - 3.6656600 0.6144180 0.45092100 - 1.4674600 0.4037980 0.23858600 -SP 3 1.00 - 2.1562300 -0.2529230 -0.01776530 - 0.7489970 0.0328517 0.27405800 - 0.2831450 1.0812500 0.78542100 -SP 1 1.00 - 0.0998317 1.0000000 1.00000000 -D 1 1.00 - 0.5500000 1.0000000 -**** -S 0 -S 6 1.00 - 21917.1000000 0.0018690 - 3301.4900000 0.0142300 - 754.1460000 0.0696960 - 212.7110000 0.2384870 - 67.9896000 0.4833070 - 23.0515000 0.3380740 -SP 6 1.00 - 423.7350000 -0.0023767 0.0040610 - 100.7100000 -0.0316930 0.0306810 - 32.1599000 -0.1133170 0.1304520 - 11.8079000 0.0560900 0.3272050 - 4.6311000 0.5922550 0.4528510 - 1.8702500 0.4550060 0.2560420 -SP 3 1.00 - 2.6158400 -0.2503740 -0.0145110 - 0.9221670 0.0669570 0.3102630 - 0.3412870 1.0545100 0.7544830 -SP 1 1.00 - 0.1171670 1.0000000 1.0000000 -D 1 1.00 - 0.6500000 1.0000000 -**** -Cl 0 -S 6 1.00 - 25180.1000000 0.0018330 - 3780.3500000 0.0140340 - 860.4740000 0.0690970 - 242.1450000 0.2374520 - 77.3349000 0.4830340 - 26.2470000 0.3398560 -SP 6 1.00 - 491.7650000 -0.0022974 0.0039894 - 116.9840000 -0.0307140 0.0303180 - 37.4153000 -0.1125280 0.1298800 - 13.7834000 0.0450160 0.3279510 - 5.4521500 0.5893530 0.4535270 - 2.2258800 0.4652060 0.2521540 -SP 3 1.00 - 3.1864900 -0.2518300 -0.0142990 - 1.1442700 0.0615890 0.3235720 - 0.4203770 1.0601800 0.7435070 -SP 1 1.00 - 0.1426570 1.0000000 1.0000000 -D 1 1.00 - 0.7500000 1.0000000 -**** -Ar 0 -S 6 1.00 - 28348.3000000 0.00182526 - 4257.6200000 0.01396860 - 969.8570000 0.06870730 - 273.2630000 0.23620400 - 87.3695000 0.48221400 - 29.6867000 0.34204300 -SP 6 1.00 - 575.8910000 -0.00215972 0.00380665 - 136.8160000 -0.02907750 0.02923050 - 43.8098000 -0.11082700 0.12646700 - 16.2094000 0.02769990 0.32351000 - 6.4608400 0.57761300 0.45489600 - 2.6511400 0.48868800 0.25663000 -SP 3 1.00 - 3.8602800 -0.2555920 -0.01591970 - 1.4137300 0.0378066 0.32464600 - 0.5166460 1.0805600 0.74399000 -SP 1 1.00 - 0.1738880 1.0000000 1.0000000 -D 1 1.00 - 0.8500000 1.0000000 -**** -K 0 -S 6 1.00 - 31594.4200000 1.828010E-03 - 4744.3300000 1.399403E-02 - 1080.4190000 6.887129E-02 - 304.2338000 2.369760E-01 - 97.2458600 4.829040E-01 - 33.0249500 3.404795E-01 -SP 6 1.00 - 622.7625000 -2.502976E-03 4.094637E-03 - 147.8839000 -3.315550E-02 3.145199E-02 - 47.3273500 -1.226387E-01 1.351558E-01 - 17.5149500 5.353643E-02 3.390500E-01 - 6.9227220 6.193860E-01 4.629455E-01 - 2.7682770 4.345878E-01 2.242638E-01 -SP 6 1.00 - 11.8480200 1.277689E-02 -1.221377E-02 - 4.0792110 2.098767E-01 -6.900537E-03 - 1.7634810 -3.095274E-03 2.007466E-01 - 0.7889270 -5.593884E-01 4.281332E-01 - 0.3503870 -5.134760E-01 3.970156E-01 - 0.1463440 -6.598035E-02 1.104718E-01 -SP 3 1.00 - 0.7168010 -5.237772E-02 0.0316430 - 0.2337410 -2.798503E-01 -0.0404616 - 0.0386750 1.141547E+00 1.0120290 -SP 1 1.00 - 0.0165210 1.000000E+00 1.00000000 -D 1 1.00 - 0.2000000 1.0000000 -**** -Ca 0 -S 6 1.00 - 35264.8600000 1.813501E-03 - 5295.5030000 1.388493E-02 - 1206.0200000 6.836162E-02 - 339.6839000 2.356188E-01 - 108.6264000 4.820639E-01 - 36.9210300 3.429819E-01 -SP 6 1.00 - 706.3096000 2.448225E-03 4.020371E-03 - 167.8187000 3.241504E-02 3.100601E-02 - 53.8255800 1.226219E-01 1.337279E-01 - 20.0163800 -4.316965E-02 3.367983E-01 - 7.9702790 -6.126995E-01 4.631281E-01 - 3.2120590 -4.487540E-01 2.257532E-01 -SP 6 1.00 - 14.1951800 1.084500E-02 -1.289621E-02 - 4.8808280 2.088333E-01 -1.025198E-02 - 2.1603900 3.150338E-02 1.959781E-01 - 0.9878990 -5.526518E-01 4.357933E-01 - 0.4495170 -5.437997E-01 3.996452E-01 - 0.1873870 -6.669342E-02 9.713636E-02 -SP 3 1.00 - 1.0322710 -4.439720E-02 -0.4298621 - 0.3811710 -3.284563E-01 0.006935829 - 0.0651310 1.163010E+00 0.9705933 -SP 1 1.00 - 0.0260100 1.000000E+00 1.00000000 -D 1 1.00 - 0.2000000 1.0000000 -**** -Sc 0 -S 6 1.00 - 39088.9800000 1.803263E-03 - 5869.7920000 1.380769E-02 - 1336.9100000 6.800396E-02 - 376.6031000 2.347099E-01 - 120.4679000 4.815690E-01 - 40.9803200 3.445652E-01 -SP 6 1.00 - 786.2852000 2.451863E-03 4.039530E-03 - 186.8870000 3.259579E-02 3.122570E-02 - 60.0093500 1.238242E-01 1.349833E-01 - 22.2588300 -4.359890E-02 3.424793E-01 - 8.8851490 -6.177181E-01 4.623113E-01 - 3.6092110 -4.432823E-01 2.177524E-01 -SP 6 1.00 - 29.8435500 -2.586302E-03 -6.096652E-03 - 9.5423830 7.188424E-02 -2.628884E-02 - 4.0567900 2.503260E-01 5.091001E-02 - 1.7047030 -2.991003E-01 3.798097E-01 - 0.7062340 -7.446818E-01 5.170883E-01 - 0.2795360 -1.799776E-01 1.829772E-01 -SP 3 1.00 - 1.0656090 6.482978E-02 -0.2938440 - 0.4259330 3.253756E-01 0.09235323 - 0.0763200 -1.170806E+00 0.9847930 -SP 1 1.00 - 0.0295940 1.000000E+00 1.00000000 -D 3 1.00 - 11.1470100 8.747672E-02 - 2.8210430 3.795635E-01 - 0.8196200 7.180393E-01 -D 1 1.00 - 0.2214680 1.0000000 -F 1 1.00 - 0.8000000 1.0000000 -**** -Ti 0 -S 6 1.00 - 43152.9500000 1.791872E-03 - 6479.5710000 1.372392E-02 - 1475.6750000 6.762830E-02 - 415.6991000 2.337642E-01 - 133.0006000 4.810696E-01 - 45.2722200 3.462280E-01 -SP 6 1.00 - 874.6826000 2.431008E-03 4.017679E-03 - 207.9785000 3.233027E-02 3.113966E-02 - 66.8791800 1.242520E-01 1.349077E-01 - 24.8734700 -3.903905E-02 3.431672E-01 - 9.9684410 -6.171789E-01 4.625760E-01 - 4.0638260 -4.473097E-01 2.154603E-01 -SP 6 1.00 - 33.6436300 -2.940358E-03 -6.311620E-03 - 10.8756500 7.163103E-02 -2.697638E-02 - 4.6282250 2.528915E-01 5.316847E-02 - 1.9501260 -2.966401E-01 3.845549E-01 - 0.8094520 -7.432215E-01 5.127662E-01 - 0.3204740 -1.853520E-01 1.811135E-01 -SP 3 1.00 - 1.2241480 6.351465E-02 -0.2112070 - 0.4842630 3.151404E-01 0.07771998 - 0.0840960 -1.162595E+00 0.9898214 -SP 1 1.00 - 0.0320360 1.000000E+00 1.00000000 -D 3 1.00 - 13.6908500 8.589418E-02 - 3.5131540 3.784671E-01 - 1.0404340 7.161239E-01 -D 1 1.00 - 0.2869620 1.0000000 -F 1 1.00 - 0.8000000 1.0000000 -**** -V 0 -S 6 1.00 - 47354.3300000 1.784513E-03 - 7110.7870000 1.366754E-02 - 1619.5910000 6.736122E-02 - 456.3379000 2.330552E-01 - 146.0606000 4.806316E-01 - 49.7579100 3.474802E-01 -SP 6 1.00 - 968.1484000 2.410599E-03 3.995005E-03 - 230.2821000 3.207243E-02 3.104061E-02 - 74.1459100 1.245942E-01 1.347747E-01 - 27.6410700 -3.482177E-02 3.437279E-01 - 11.1147500 -6.167374E-01 4.628759E-01 - 4.5431130 -4.509844E-01 2.135547E-01 -SP 6 1.00 - 37.6405000 -3.233199E-03 -6.494056E-03 - 12.2823800 7.130744E-02 -2.753453E-02 - 5.2333660 2.543820E-01 5.516284E-02 - 2.2089500 -2.933887E-01 3.879672E-01 - 0.9178800 -7.415695E-01 5.090258E-01 - 0.3634120 -1.909410E-01 1.803840E-01 -SP 3 1.00 - 1.3927810 6.139703E-02 -0.1891265 - 0.5439130 3.061130E-01 0.08005453 - 0.0914760 -1.154890E+00 0.9877399 -SP 1 1.00 - 0.0343120 1.000000E+00 1.00000000 -D 3 1.00 - 16.0502500 8.599899E-02 - 4.1600630 3.802996E-01 - 1.2432650 7.127659E-01 -D 1 1.00 - 0.3442770 1.0000000 -F 1 1.00 - 0.8000000 1.0000000 -**** -Cr 0 -S 6 1.00 - 51789.8100000 1.776182E-03 - 7776.8490000 1.360476E-02 - 1771.3850000 6.706925E-02 - 499.1588000 2.323104E-01 - 159.7982000 4.802410E-01 - 54.4702100 3.487653E-01 -SP 6 1.00 - 1064.3280000 2.399669E-03 3.986997E-03 - 253.2138000 3.194886E-02 3.104662E-02 - 81.6092400 1.250868E-01 1.350518E-01 - 30.4819300 -3.221866E-02 3.448865E-01 - 12.2943900 -6.172284E-01 4.628571E-01 - 5.0377220 -4.525936E-01 2.110426E-01 -SP 6 1.00 - 41.5629100 -3.454216E-03 -6.722497E-03 - 13.6762700 7.218428E-02 -2.806471E-02 - 5.8443900 2.544820E-01 5.820028E-02 - 2.4716090 -2.934534E-01 3.916988E-01 - 1.0283080 -7.385455E-01 5.047823E-01 - 0.4072500 -1.947157E-01 1.790290E-01 -SP 3 1.00 - 1.5714640 0.05892219 -0.1930100 - 0.6055800 0.2976055 0.0960562 - 0.0985610 -1.1475060 0.9817609 -SP 1 1.00 - 0.0364590 1.000000E+00 1.0000000 -D 3 1.00 - 18.4193000 8.650816E-02 - 4.8126610 3.826699E-01 - 1.4464470 7.093772E-01 -D 1 1.00 - 0.4004130 1.0000000 -F 1 1.00 - 0.8000000 1.0000000 -**** -Mn 0 -S 6 1.00 - 56347.1400000 1.771580E-03 - 8460.9430000 1.357081E-02 - 1927.3250000 6.690605E-02 - 543.2343000 2.318541E-01 - 173.9905000 4.799046E-01 - 59.3600500 3.495737E-01 -SP 6 1.00 - 1165.4120000 2.388751E-03 3.977318E-03 - 277.3276000 3.181708E-02 3.103112E-02 - 89.4727800 1.254670E-01 1.351894E-01 - 33.4825600 -2.955431E-02 3.457387E-01 - 13.5403700 -6.175160E-01 4.629205E-01 - 5.5579720 -4.544458E-01 2.090592E-01 -SP 6 1.00 - 45.8353200 -3.665856E-03 -6.887578E-03 - 15.1877700 7.231971E-02 -2.846816E-02 - 6.5007100 2.544486E-01 6.031832E-02 - 2.7515830 -2.910380E-01 3.938961E-01 - 1.1454040 -7.359860E-01 5.013769E-01 - 0.4536870 -1.997617E-01 1.792264E-01 -SP 3 1.00 - 1.7579990 0.05628572 -0.5035024 - 0.6670220 0.2897491 0.2345011 - 0.1051290 -1.1406530 0.9141257 -SP 1 1.00 - 0.0384180 1.000000E+00 1.00000000 -D 3 1.00 - 20.9435500 8.672702E-02 - 5.5104860 3.841883E-01 - 1.6650380 7.069071E-01 -D 1 1.00 - 0.4617330 1.0000000 -F 1 1.00 - 0.8000000 1.0000000 -**** -Fe 0 -S 6 1.00 - 61132.6200000 1.766111E-03 - 9179.3420000 1.353038E-02 - 2090.8570000 6.673128E-02 - 589.2479000 2.314823E-01 - 188.7543000 4.797058E-01 - 64.4462900 3.501976E-01 -SP 6 1.00 - 1259.9800000 2.438014E-03 4.028019E-03 - 299.8761000 3.224048E-02 3.144647E-02 - 96.8491700 1.265724E-01 1.368317E-01 - 36.3102000 -3.139902E-02 3.487236E-01 - 14.7299600 -6.207593E-01 4.617931E-01 - 6.0660750 -4.502914E-01 2.043058E-01 -SP 6 1.00 - 50.4348500 -3.873256E-03 -7.017128E-03 - 16.8392900 7.196598E-02 -2.877660E-02 - 7.1920860 2.556591E-01 6.181383E-02 - 3.0534200 -2.882837E-01 3.954946E-01 - 1.2736430 -7.342822E-01 4.989059E-01 - 0.5040910 -2.049353E-01 1.791251E-01 -SP 3 1.00 - 1.9503160 0.05694869 -0.4593796 - 0.7367210 0.2882915 0.2852139 - 0.1141770 -1.1381590 0.9076485 -SP 1 1.00 - 0.0411480 1.000000E+00 1.00000000 -D 3 1.00 - 23.1499400 8.876935E-02 - 6.1223680 3.896319E-01 - 1.8466010 7.014816E-01 -D 1 1.00 - 0.5043610 1.0000000 -F 1 1.00 - 0.8000000 1.0000000 -**** -Co 0 -S 6 1.00 - 66148.9900000 1.759787E-03 - 9933.0770000 1.348162E-02 - 2262.8160000 6.649342E-02 - 637.9154000 2.307939E-01 - 204.4122000 4.792919E-01 - 69.8253800 3.514097E-01 -SP 6 1.00 - 1378.8410000 2.376276E-03 3.971488E-03 - 328.2694000 3.167450E-02 3.108174E-02 - 106.0946000 1.262888E-01 1.357439E-01 - 39.8327500 -2.584552E-02 3.476827E-01 - 16.1862200 -6.183491E-01 4.626340E-01 - 6.6677880 -4.567008E-01 2.051632E-01 -SP 6 1.00 - 54.5235500 -3.993004E-03 -7.290772E-03 - 18.2978300 7.409663E-02 -2.926027E-02 - 7.8673480 2.542000E-01 6.564150E-02 - 3.3405340 -2.921657E-01 4.000652E-01 - 1.3937560 -7.318703E-01 4.950236E-01 - 0.5513260 -2.040784E-01 1.758240E-01 -SP 3 1.00 - 2.1519470 0.05379843 -0.2165496 - 0.8110630 0.2759971 0.1240488 - 0.1210170 -1.1296920 0.9724064 -SP 1 1.00 - 0.0430370 1.000000E+00 1.00000000 -D 3 1.00 - 25.5930600 9.004748E-02 - 6.8009900 3.931703E-01 - 2.0516470 6.976844E-01 -D 1 1.00 - 0.5556710 1.0000000 -F 1 1.00 - 0.8000000 1.0000000 -**** -Ni 0 -S 6 1.00 - 71396.3500000 1.753003E-03 - 10720.8400000 1.343122E-02 - 2442.1290000 6.627041E-02 - 688.4265000 2.302508E-01 - 220.6153000 4.790186E-01 - 75.3937300 3.523444E-01 -SP 6 1.00 - 1492.5320000 2.370714E-03 3.967554E-03 - 355.4013000 3.160566E-02 3.109479E-02 - 114.9534000 1.266335E-01 1.359517E-01 - 43.2204300 -2.417037E-02 3.485136E-01 - 17.5971000 -6.187775E-01 4.625498E-01 - 7.2577650 -4.576770E-01 2.035186E-01 -SP 6 1.00 - 59.3526100 -4.162002E-03 -7.421452E-03 - 20.0218100 7.425111E-02 -2.953410E-02 - 8.6145610 2.541360E-01 6.731852E-02 - 3.6605310 -2.903477E-01 4.016660E-01 - 1.5281110 -7.302121E-01 4.926623E-01 - 0.6040570 -2.076057E-01 1.756893E-01 -SP 3 1.00 - 2.3792760 0.05157888 -0.1887663 - 0.8858390 0.2707611 0.1015199 - 0.1285290 -1.1247700 0.9790906 -SP 1 1.00 - 0.0451950 1.000000E+00 1.00000000 -D 3 1.00 - 28.1914700 9.098881E-02 - 7.5235840 3.958208E-01 - 2.2712280 6.947154E-01 -D 1 1.00 - 0.6116030 1.0000000 -F 1 1.00 - 0.8000000 1.0000000 -**** -Cu 0 -S 6 1.00 - 76794.3800000 1.748161E-03 - 11530.7000000 1.339602E-02 - 2626.5750000 6.610885E-02 - 740.4903000 2.298265E-01 - 237.3528000 4.787675E-01 - 81.1581800 3.530739E-01 -SP 6 1.00 - 1610.8140000 2.364055E-03 3.963307E-03 - 383.6367000 3.153635E-02 3.110223E-02 - 124.1733000 1.269452E-01 1.361350E-01 - 46.7467800 -2.262840E-02 3.492914E-01 - 19.0656900 -6.192080E-01 4.624780E-01 - 7.8715670 -4.585393E-01 2.020102E-01 -SP 6 1.00 - 64.4573200 -4.331075E-03 -7.523725E-03 - 21.8521200 7.412307E-02 -2.975687E-02 - 9.4053430 2.542108E-01 6.849654E-02 - 3.9991680 -2.874843E-01 4.027141E-01 - 1.6702970 -7.291436E-01 4.908490E-01 - 0.6596270 -2.113951E-01 1.759268E-01 -SP 3 1.00 - 2.6000880 0.05027577 -0.1702911 - 0.9630940 0.2650040 0.09310133 - 0.1361610 -1.1201550 0.9814336 -SP 1 1.00 - 0.0473320 1.000000E+00 1.00000000 -D 3 1.00 - 30.8534100 9.199905E-02 - 8.2649850 3.985021E-01 - 2.4953320 6.917897E-01 -D 1 1.00 - 0.6676580 1.0000000 -F 1 1.00 - 0.8000000 1.0000000 -**** -Zn 0 -S 6 1.00 - 82400.9400000 1.743329E-03 - 12372.5500000 1.335966E-02 - 2818.3510000 6.594365E-02 - 794.5717000 2.294151E-01 - 254.7232000 4.785453E-01 - 87.1388000 3.537753E-01 -SP 6 1.00 - 1732.5690000 2.361459E-03 3.963125E-03 - 412.7149000 3.150177E-02 3.113411E-02 - 133.6780000 1.272774E-01 1.363931E-01 - 50.3858500 -2.145928E-02 3.501266E-01 - 20.5835800 -6.197652E-01 4.623179E-01 - 8.5059400 -4.590180E-01 2.004995E-01 -SP 6 1.00 - 69.3649200 -4.440098E-03 -7.689262E-03 - 23.6208200 7.505253E-02 -2.997982E-02 - 10.1847100 2.533111E-01 7.082411E-02 - 4.3340820 -2.881897E-01 4.046141E-01 - 1.8109180 -7.267052E-01 4.882325E-01 - 0.7148410 -2.133439E-01 1.751970E-01 -SP 3 1.00 - 2.8238420 0.04898543 -0.1586763 - 1.0395430 0.2592793 0.08379327 - 0.1432640 -1.1157110 0.9840547 -SP 1 1.00 - 0.0492960 1.000000E+00 1.00000000 -D 3 1.00 - 33.7076400 9.262648E-02 - 9.0611060 4.002980E-01 - 2.7383830 6.896608E-01 -D 1 1.00 - 0.7302940 1.0000000 -F 1 1.00 - 0.8000000 1.0000000 -**** - diff --git a/src/bin/libint/CMakeLists.txt b/src/bin/libint/CMakeLists.txt index f34421ac7..ffb0b896f 100644 --- a/src/bin/libint/CMakeLists.txt +++ b/src/bin/libint/CMakeLists.txt @@ -1,7 +1,3 @@ -cmake_minimum_required(VERSION 3.16) # UNITY_BUILD -cmake_policy(SET CMP0074 NEW) -list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) - # <<< Build >>> if(MSVC) @@ -13,7 +9,7 @@ endif() ### compiler library -add_library(libint-libcompiler +add_library(libint-libcompiler STATIC algebra.cc buildtest.cc class_registry.cc @@ -61,13 +57,22 @@ set_target_properties(libint-libcompiler PROPERTIES LIBRARY_OUTPUT_NAME int2-lib ## compiler library dependencies find_package(Boost 1.57 REQUIRED) -target_link_libraries(libint-libcompiler PUBLIC Boost::boost) +find_package(Multiprecision MODULE REQUIRED COMPONENTS gmpxx) +target_link_libraries( + libint-libcompiler + PUBLIC + Boost::headers + Multiprecision::gmpxx + ) -find_package(MPFR REQUIRED) # only GMPXX is actually required ... -target_link_libraries(libint-libcompiler PUBLIC MPFR::GMPXX) -message("MPFR ${MPFR_INCLUDE} ${MPFR_LIBRARY}") -message("GMP ${GMP_INCLUDE} ${GMP_LIBRARY}") -message("GMPXX ${GMPXX_INCLUDE} ${GMPXX_LIBRARY}") +get_property(_loc TARGET Multiprecision::gmp PROPERTY LOCATION) +message(STATUS "${Cyan}Found GMP${ColourReset}: ${_loc}") +get_property(_loc TARGET Multiprecision::gmpxx PROPERTY LOCATION) +message(STATUS "${Cyan}Found GMPXX${ColourReset}: ${_loc}") +if (TARGET Multiprecision::mpfr) + get_property(_loc TARGET Multiprecision::mpfr PROPERTY LOCATION) + message(STATUS "${Cyan}Found MPFR${ColourReset}: ${_loc} (found version ${MPFR_VERSION})") +endif() ### executables compiler and test diff --git a/src/bin/libint/prefactors.cc b/src/bin/libint/prefactors.cc index eb686a14e..9dfc0c302 100644 --- a/src/bin/libint/prefactors.cc +++ b/src/bin/libint/prefactors.cc @@ -51,12 +51,12 @@ Prefactors::Prefactors() : char xyz_str[] = "xyz"; for(int xyz=0; xyz<3; xyz++) { - char XY_X_i_str[20]; + char XY_X_i_str[sizeof(XY_X_str)+2]; sprintf(XY_X_i_str,"%s_%c",XY_X_str,xyz_str[xyz]); rdptr XY_X_i_ptr(new rdouble(XY_X_i_str)); XY_X[p][braket][xyz] = XY_X_i_ptr; - char W_XY_i_str[20]; + char W_XY_i_str[sizeof(W_XY_str)+2]; sprintf(W_XY_i_str,"%s_%c",W_XY_str,xyz_str[xyz]); rdptr W_XY_i_ptr(new rdouble(W_XY_i_str)); W_XY[p][xyz] = W_XY_i_ptr; @@ -70,7 +70,7 @@ Prefactors::Prefactors() : vX_Y[p] = vX_Y_ptr; const char xyz_str[] = "xyz"; for(int xyz=0; xyz<3; xyz++) { - char X_Y_i_str[20]; + char X_Y_i_str[sizeof(X_Y_str)+2]; sprintf(X_Y_i_str,"%s_%c",X_Y_str,xyz_str[xyz]); rdptr X_Y_i_ptr(new rdouble(X_Y_i_str)); X_Y[p][xyz] = X_Y_i_ptr; @@ -81,7 +81,7 @@ Prefactors::Prefactors() : rdptr vY_X_ptr(new rdouble(Y_X_str)); vY_X[p] = vY_X_ptr; for(int xyz=0; xyz<3; xyz++) { - char Y_X_i_str[20]; + char Y_X_i_str[sizeof(Y_X_str)+2]; sprintf(Y_X_i_str,"%s_%c",Y_X_str,xyz_str[xyz]); rdptr Y_X_i_ptr(new rdouble(Y_X_i_str)); Y_X[p][xyz] = Y_X_i_ptr; diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index d3d54c5b2..51f8cd172 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -1,22 +1,19 @@ -cmake_minimum_required(VERSION 3.8) -cmake_policy(SET CMP0074 NEW) -list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) list(APPEND CMAKE_MODULE_PATH ${PROJECT_BINARY_DIR}/cmake/modules) include(GNUInstallDirs) include(int_computed) # for macros.tex -# <<< Generate Library >>> +# <<< Generate Library Source >>> file(MAKE_DIRECTORY "${EXPORT_STAGE_DIR}/src") add_custom_command(OUTPUT "${EXPORT_STAGE_DIR}/src/libint2_params.h" COMMAND "${PROJECT_BINARY_DIR}/src/bin/libint/build_libint" WORKING_DIRECTORY "${EXPORT_STAGE_DIR}/src" DEPENDS "${PROJECT_BINARY_DIR}/src/bin/libint/build_libint" - COMMENT "Generating Libint2 library") + COMMENT "Generating Libint2 library source") add_custom_target(libint-library-generate DEPENDS "${EXPORT_STAGE_DIR}/src/libint2_params.h") -# <<< Add Metadata To The Library >>> +# <<< Add Metadata To The Library Source >>> configure_file("${PROJECT_SOURCE_DIR}/doc/progman/macros.tex.in" "${EXPORT_STAGE_DIR}/doc/macros.tex" @ONLY) set(DATADIR_ABSOLUTE ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/libint/${LIBINT_VERSION}) @@ -30,25 +27,25 @@ add_custom_command(OUTPUT ${EXPORT_STAGE_DIR}/CMakeLists.txt "-DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}" "-DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR}" "-DEXPORT_STAGE_DIR=${EXPORT_STAGE_DIR}" - "-DLIBINT_VERSION=${LIBINT_VERSION}" -P ${CMAKE_CURRENT_SOURCE_DIR}/populate.cmake COMMENT "Populating Libint2 library") add_custom_target(libint-library-populate DEPENDS ${EXPORT_STAGE_DIR}/CMakeLists.txt) -# <<< Export The Library >>> +# <<< Export The Library Source >>> add_custom_command(OUTPUT "${EXPORT_STAGE_DIR}.tgz" - COMMAND ${CMAKE_COMMAND} -E tar "cfvz" "${EXPORT_STAGE_DIR}.tgz" "${EXPORT_STAGE_DIR}" + COMMAND ${CMAKE_COMMAND} -E tar "cfz" "${EXPORT_STAGE_DIR}.tgz" "${EXPORT_STAGE_DIR}" WORKING_DIRECTORY "${EXPORT_STAGE_DIR}/.." DEPENDS libint-library-generate libint-library-populate - COMMENT "Exporting Libint2 library") + COMMENT "Exporting tarball of Libint2 library source") if (LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) # rerun cmake if building as subproject to unpack and consume the library as subproject add_custom_target(libint-library-export DEPENDS "${EXPORT_STAGE_DIR}.tgz" COMMAND ${CMAKE_COMMAND} -S "${CMAKE_SOURCE_DIR}" -B "${CMAKE_BINARY_DIR}") -else (LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) +else() add_custom_target(libint-library-export DEPENDS "${EXPORT_STAGE_DIR}.tgz") -endif (LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) +endif() +add_custom_target(export DEPENDS libint-library-export) # <<< Build Library >>> @@ -76,7 +73,7 @@ if (LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) message(WARNING "LIBINT_BUILD_LIBRARY_AS_SUBPROJECT=ON but library has not been exported yet; build target 'libint-library-export' first, this will make library build/test targets ('check', 'install') available") endif() -else(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) +else() include(ExternalProject) include(GNUInstallDirs) @@ -86,30 +83,58 @@ else(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR} -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR} - -DCMAKE_INSTALL_DATAROOTDIR=${CMAKE_INSTALL_DATAROOTDIR} + -DCMAKE_INSTALL_DATADIR=${CMAKE_INSTALL_DATADIR} + -DLIBINT2_INSTALL_CMAKEDIR=${LIBINT2_INSTALL_CMAKEDIR} + -DLIBINT2_INSTALL_BASISDIR=${LIBINT2_INSTALL_BASISDIR} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} + -DLIBINT2_BUILD_SHARED_AND_STATIC_LIBS=${LIBINT2_BUILD_SHARED_AND_STATIC_LIBS} -DREQUIRE_CXX_API=${REQUIRE_CXX_API} + -DREQUIRE_CXX_API_COMPILED=${REQUIRE_CXX_API_COMPILED} -DENABLE_FORTRAN=${ENABLE_FORTRAN} -DLIBINT2_SHGAUSS_ORDERING=${LIBINT2_SHGAUSS_ORDERING} -DBUILD_TESTING=${BUILD_TESTING} + -DENABLE_MPFR=${ENABLE_MPFR} + -DLIBINT2_REALTYPE=${LIBINT2_REALTYPE} + -DENABLE_XHOST=${ENABLE_XHOST} ) if (CMAKE_C_COMPILER) list(APPEND library_CMAKE_ARGS "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" ) - endif(CMAKE_C_COMPILER) + endif() if (ENABLE_FORTRAN AND CMAKE_Fortran_COMPILER) list(APPEND library_CMAKE_ARGS "-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}" ) - endif(ENABLE_FORTRAN AND CMAKE_Fortran_COMPILER) - if (CMAKE_PREFIX_PATH) + endif() + if (Eigen3_DIR) + list(APPEND library_CMAKE_ARGS + "-DEigen3_DIR=${Eigen3_DIR}" + ) + endif() + if (Eigen3_ROOT) + list(APPEND library_CMAKE_ARGS + "-DEigen3_ROOT=${Eigen3_ROOT}" + ) + endif() + if (Boost_DIR) + list(APPEND library_CMAKE_ARGS + "-DBoost_DIR=${Boost_DIR}" + ) + endif() + if (BOOST_ROOT) + list(APPEND library_CMAKE_ARGS + "-DBOOST_ROOT=${BOOST_ROOT}" + ) + endif() + if (LIBINT_LOCAL_Eigen3_INSTALL) list(APPEND library_CMAKE_ARGS - "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" + "-DLIBINT_LOCAL_Eigen3_INSTALL=${LIBINT_LOCAL_Eigen3_INSTALL}" ) - endif(CMAKE_PREFIX_PATH) + endif() message(STATUS "invoking ExternalProject_add to build+test Libint library with library_CMAKE_ARGS=${library_CMAKE_ARGS}") ExternalProject_Add(library @@ -120,30 +145,32 @@ else(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) # DOWNLOAD_DIR # this is tidier but fails on Windows LOG_DOWNLOAD 1 CMAKE_ARGS "${library_CMAKE_ARGS}" - CMAKE_CACHE_ARGS -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} - -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS} + CMAKE_CACHE_ARGS + -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} + -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS} + -DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH} TEST_COMMAND "" USES_TERMINAL_CONFIGURE TRUE USES_TERMINAL_BUILD TRUE USES_TERMINAL_INSTALL TRUE STEP_TARGETS configure - BUILD_BYPRODUCTS ${STAGED_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} ${STAGED_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR} ${STAGED_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR} + BUILD_BYPRODUCTS ${STAGED_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} ${STAGED_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR} ${STAGED_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR} ) ExternalProject_Get_property(library BINARY_DIR) # instead of running tests by default, replicate check-libint2 target here and use it to invoke library's check-libint2 target - if (BUILD_TESTING) # enable_testing was already invoked at the top + if (BUILD_TESTING) include(AddCustomTargetSubproject) add_custom_target_subproject(libint2 check USES_TERMINAL COMMAND ${CMAKE_CTEST_COMMAND} -V -R "libint2/" WORKING_DIRECTORY ${BINARY_DIR} DEPENDS library-configure) - endif(BUILD_TESTING) + endif() - foreach(_dir ${CMAKE_INSTALL_LIBDIR} ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_DATAROOTDIR}) - install(DIRECTORY ${STAGED_INSTALL_PREFIX}/${_dir} - DESTINATION ${CMAKE_INSTALL_PREFIX} - USE_SOURCE_PERMISSIONS OPTIONAL) - endforeach() + install( + DIRECTORY ${STAGED_INSTALL_PREFIX}/ + DESTINATION ${CMAKE_INSTALL_PREFIX} + USE_SOURCE_PERMISSIONS OPTIONAL + ) -endif(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) +endif() diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 67c95af88..0248cc005 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -1,18 +1,24 @@ -cmake_minimum_required(VERSION 3.16) # UNITY_BUILD +cmake_minimum_required(VERSION 3.16) cmake_policy(SET CMP0074 NEW) -project(Libint2 - LANGUAGES CXX) -set(library_AUTHORS "Edward F. Valeev") -set(library_DESCRIPTION "High-performance library for computing Gaussian integrals in quantum mechanics") -set(library_URL "https://github.com/evaleev/libint") -set(library_LICENSE "LGPL-3.0") +############################# Version and Metadata ############################# -set(NS Libint2) # Namespace -set(PN ${PROJECT_NAME}) # ProjectName -set(pnv libint2) # projectnameversion +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) +include(int_computed) -list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) +project( + Libint2 + VERSION ${LIBINT_VERSION} + DESCRIPTION "High-performance library for computing Gaussian integrals in quantum mechanics" + HOMEPAGE_URL "https://github.com/evaleev/libint" + LANGUAGES CXX + ) + +set(${PROJECT_NAME}_AUTHORS "Edward F. Valeev") +set(${PROJECT_NAME}_LICENSE "LGPL-3.0") + +set(L2 Libint2) # Namespace +set(pnv libint2) # projectnameversion ################################### Overview ################################### @@ -22,20 +28,25 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) # libint2/boost headers are installed or not ################################### Options #################################### +include(GNUInstallDirs) +include(CTest) include(options) -include(int_computed) - # <<< General >>> option_with_default(CMAKE_BUILD_TYPE "Build type" Release) option_with_print(REQUIRE_CXX_API "C++11 Libint API: define library targets + test (requires Eigen3)" ON) -option_with_print(ENABLE_FORTRAN "Build Fortran03+ Libint interface (requires C and Fortran)" OFF) -option_with_print(BUILD_TESTING "Compile the testing infrastructure" ON) -option_with_print(ENABLE_MPFR "Use GNU MPFR library for high-precision testing (EXPERTS ONLY)" OFF) -option_with_print(LIBINT2_BUILD_SHARED_AND_STATIC_LIBS "Build in one shot static and shared library variants. Uses -fPIC." OFF) -if (NOT LIBINT2_REALTYPE) - set(LIBINT2_REALTYPE double) +option_with_print(REQUIRE_CXX_API_COMPILED "Build C++11 Compiled (not just header-only) targets (requires Eigen3)" ON) +option_with_print(ENABLE_FORTRAN "Build Fortran03+ Libint interface (requires C and Fortran and Python)" OFF) +option_with_print(ENABLE_MPFR "Use GNU MPFR library for high-precision testing (requires MPFR. EXPERTS ONLY)" OFF) +option_with_print(BUILD_SHARED_LIBS "Build Libint library as shared, not static" OFF) +option_with_print(LIBINT2_BUILD_SHARED_AND_STATIC_LIBS "Build both shared and static Libint libraries in one shot. Uses -fPIC." OFF) +option_with_print(LIBINT_LOCAL_Eigen3_INSTALL "Install an exported target with hard-coded Eigen3 dependency paths. This is potentially useful and important when consuming the compiled C++11 interface library so that the Libint library build and Libint consumer build use the same Eigen3 installation & ABI. This is at most a convenience when consuming the header-only C++11 interface library. In consumer build, set `LIBINT_LOCAL_Eigen3_FIND=ON` before `find_package(Libint2) to load the exported Eigen3." OFF) +option_with_default(LIBINT2_REALTYPE "Specifies the floating-point data type used by the library." double) +include(xhost) # defines: option(ENABLE_XHOST "Enable processor-specific optimization" ON) + +if (REQUIRE_CXX_API_COMPILED AND NOT REQUIRE_CXX_API) + set(REQUIRE_CXX_API 1) endif() if(ENABLE_FORTRAN) @@ -44,7 +55,7 @@ if(ENABLE_FORTRAN) if (CMAKE_Fortran_COMPILER) enable_language(Fortran) else() - message(FATAL_ERROR "Given ENABLE_FORTRAN=ON but could not find Fortran compiler, provide via CMAKE_Fortran_COMPILER") + message(FATAL_ERROR "Given ENABLE_FORTRAN=ON but could not find Fortran compiler. Provide via CMAKE_Fortran_COMPILER") endif() endif() @@ -63,7 +74,27 @@ message(STATUS "Setting option LIBINT2_SHELL_SET: ${LIBINT2_SHELL_SET} (read-onl # <<< Miscellaneous >>> -option_with_default(CMAKE_INSTALL_LIBDIR "Directory to which libraries installed" lib) +# next one defined by `include(CTest)` +message(STATUS "Showing option BUILD_TESTING: ${BUILD_TESTING}") + +# <<< Path >>> + +# * use GNUInstallDirs defaults, but define others for CMake and basis files +# * LIBINT2_ dirs are STRING, not PATH, to preserve relative paths + +# next four defined by `include(GNUInstallDirs)` +message(STATUS "Showing option CMAKE_INSTALL_BINDIR: ${CMAKE_INSTALL_BINDIR}") +message(STATUS "Showing option CMAKE_INSTALL_LIBDIR: ${CMAKE_INSTALL_LIBDIR}") +message(STATUS "Showing option CMAKE_INSTALL_INCLUDEDIR: ${CMAKE_INSTALL_INCLUDEDIR}") +message(STATUS "Showing option CMAKE_INSTALL_DATADIR: ${CMAKE_INSTALL_DATADIR}") +set(LIBINT2_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${pnv}" + CACHE STRING "Directory to which CMake files are installed") +message(STATUS "Showing option LIBINT2_INSTALL_CMAKEDIR: ${LIBINT2_INSTALL_CMAKEDIR}") +set(LIBINT2_INSTALL_BASISDIR "${CMAKE_INSTALL_DATADIR}/libint/${LIBINT_VERSION}" + CACHE STRING "Directory to which data files are installed. basis/ directory created within") +message(STATUS "Showing option LIBINT2_INSTALL_BASISDIR: ${LIBINT2_INSTALL_BASISDIR}") +set(LIBINT2_INSTALL_FMODDIR "${CMAKE_INSTALL_INCLUDEDIR}/${pnv}/fortran2/modules" + CACHE STRING "Directory to which Fortran module files are installed") ######################## Process & Validate Options ########################### include(autocmake_safeguards) @@ -79,116 +110,84 @@ if (MSVC) set(LIBINT2_ALIGN_SIZE "0" CACHE STRING "(LAB) I so don't understand the option handling of ALIGN_SIZE") endif() -if (NOT LIBINT2_REALTYPE) - set(LIBINT2_REALTYPE double) +find_package(Eigen3 MODULE) + +if (TARGET Eigen3::Eigen) + set(LIBINT_HAS_EIGEN 1) + set(LIBINT_HAS_CXX_API 1) +else() + set(LIBINT_HAS_CXX_API 0) +endif() +if (REQUIRE_CXX_API AND NOT ${LIBINT_HAS_CXX_API}) + message(FATAL_ERROR "C++ API cannot be built without Eigen3; configure (via CMake) and install Eigen3 and add the install prefix to CMAKE_PREFIX_PATH, or add -DREQUIRE_CXX_API=OFF to the CMake command line if the C++ API is not required") endif() -# req'd for now (no FindGMP.cmake, though one at Elemental project) if (ENABLE_MPFR) - find_package(MPFR REQUIRED) -endif(ENABLE_MPFR) + find_package(Multiprecision MODULE REQUIRED COMPONENTS gmpxx mpfr) + + get_property(_loc TARGET Multiprecision::gmp PROPERTY LOCATION) + message(STATUS "${Cyan}Found GMP${ColourReset}: ${_loc}") + get_property(_loc TARGET Multiprecision::gmpxx PROPERTY LOCATION) + message(STATUS "${Cyan}Found GMPXX${ColourReset}: ${_loc}") + get_property(_loc TARGET Multiprecision::mpfr PROPERTY LOCATION) + message(STATUS "${Cyan}Found MPFR${ColourReset}: ${_loc} (found version ${MPFR_VERSION})") +endif() -find_package(Boost 1.57) -if (TARGET Boost::boost) # the header-only target. when CMake min reaches v3.15, can switch out for Boost::headers - set(LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS 1) -else() - set(LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS 0) - - file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/include/libint2) - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar xzf ${PROJECT_SOURCE_DIR}/external/boost.tar.gz - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/include/libint2 - RESULT_VARIABLE UNPACK_BOOST_RESULT - OUTPUT_VARIABLE UNPACK_BOOST_OUTPUT - ERROR_VARIABLE UNPACK_BOOST_OUTPUT - ) - message(STATUS "Unpacking bundled Boost") - if (NOT UNPACK_BOOST_RESULT EQUAL 0) - message(FATAL_ERROR "Failed to unpack the bundled Boost! The tar command output:\n${UNPACK_BOOST_OUTPUT}") +if (REQUIRE_CXX_API) + find_package(Boost 1.57) + if (TARGET Boost::headers) + set(LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS 1) + else() + set(LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS 0) + + file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/include/libint2) + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar xzf ${PROJECT_SOURCE_DIR}/external/boost.tar.gz + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/include/libint2 + RESULT_VARIABLE UNPACK_BOOST_RESULT + OUTPUT_VARIABLE UNPACK_BOOST_OUTPUT + ERROR_VARIABLE UNPACK_BOOST_OUTPUT + ) + message(STATUS "Unpacking bundled Boost") + if (NOT UNPACK_BOOST_RESULT EQUAL 0) + message(FATAL_ERROR "Failed to unpack the bundled Boost! The tar command output:\n${UNPACK_BOOST_OUTPUT}") + endif() endif() - endif() -# look for Eigen -# prefer CMake-configured-and-installed instance -# N.B. due to the variety of ways to get Eigen will set up our own target -# re:NO_CMAKE_PACKAGE_REGISTRY: eigen3 registers its *build* tree with the user package registry ... -# to avoid issues with wiped build directory look for installed eigen -find_package(Eigen3 NO_MODULE QUIET NO_CMAKE_PACKAGE_REGISTRY) -if (TARGET Eigen3::Eigen) - add_library(libint-Eigen3 INTERFACE) - foreach(prop INTERFACE_INCLUDE_DIRECTORIES INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_OPTIONS INTERFACE_LINK_LIBRARIES INTERFACE_POSITION_INDEPENDENT_CODE) - get_property(EIGEN3_${prop} TARGET Eigen3::Eigen PROPERTY ${prop}) - set_property(TARGET libint-Eigen3 PROPERTY - ${prop} ${EIGEN3_${prop}}) - endforeach() -else (TARGET Eigen3::Eigen) - # otherwise use FindEigen3.cmake module possibly installed somewhere in the path - # but make sure EIGEN3_INCLUDE_DIR exists! - find_package(Eigen3) - if (EIGEN3_FOUND) - if (NOT EXISTS "${EIGEN3_INCLUDE_DIR}") - message(WARNING "Eigen3 is \"found\", but the reported EIGEN3_INCLUDE_DIR=${EIGEN3_INCLUDE_DIR} does not exist; likely corrupt Eigen3 build registered in user or system package registry; specify EIGEN3_INCLUDE_DIR manually or (better) configure (with CMake) and install Eigen3 package") - else(NOT EXISTS "${EIGEN3_INCLUDE_DIR}") - add_library(libint-Eigen3 INTERFACE) - set_property(TARGET libint-Eigen3 PROPERTY - INTERFACE_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIR}) - endif(NOT EXISTS "${EIGEN3_INCLUDE_DIR}") - endif (EIGEN3_FOUND) -endif (TARGET Eigen3::Eigen) -if (TARGET libint-Eigen3) - get_property(EIGEN3_INCLUDE_DIR TARGET libint-Eigen3 PROPERTY INTERFACE_INCLUDE_DIRECTORIES) - message(STATUS "Found Eigen3: EIGEN3_INCLUDE_DIR=${EIGEN3_INCLUDE_DIR}") - install(TARGETS libint-Eigen3 EXPORT "${pnv}-targets-static" COMPONENT Eigen3) -endif(TARGET libint-Eigen3) - -if (TARGET libint-Eigen3) - set(LIBINT_HAS_EIGEN 1) - set(LIBINT_HAS_CXX_API 1) -else(TARGET libint-Eigen3) - set(LIBINT_HAS_CXX_API 0) -endif(TARGET libint-Eigen3) -if (REQUIRE_CXX_API AND NOT ${LIBINT_HAS_CXX_API}) - message(FATAL_ERROR "C++ API cannot be built without Eigen3; configure (via CMake) and install Eigen3 and add the install prefix to CMAKE_PREFIX_PATH, or add -DREQUIRE_CXX_API=OFF to the CMake command line if the C++ API is not required") +# Python is optionally used for testing, but for Fortran, it's required for preprocessing. +if (ENABLE_FORTRAN) + find_package(Python COMPONENTS Interpreter REQUIRED) +else() + find_package(Python COMPONENTS Interpreter) endif() -# Python is optional, unless ... -if (ENABLE_FORTRAN) # ... need fortran - find_package(PythonInterp REQUIRED) -else(ENABLE_FORTRAN) - find_package(PythonInterp) -endif(ENABLE_FORTRAN) ################################# Main Project ################################# -include(GNUInstallDirs) include(CMakePackageConfigHelpers) -# Set install paths ==================================================================================================== - -# use defaults, but define another for CMake files -set(CMAKE_INSTALL_CMAKEDIR "lib/cmake/${pnv}" - CACHE PATH "Installation directory for CMake files") - # <<< Build >>> -if(MSVC) - # MSVC does not include constants, unless _USE_MATH_DEFINES is defined. - add_definitions("/D_USE_MATH_DEFINES") - # Set the exception handling model - add_definitions("/EHsc") -endif() - configure_file(include/libint2/config2.h.cmake.in include/libint2/config2.h @ONLY) include(srclist.cmake) -message(STATUS "LIBINT2_LIBRARY_CXX_SRC=${LIBINT2_LIBRARY_CXX_SRC}") +list(LENGTH LIBINT2_LIBRARY_CXX_SRC _source_count) +message(STATUS "Loading ${_source_count} library source files from LIBINT2_LIBRARY_CXX_SRC") +message(DEBUG "LIBINT2_LIBRARY_CXX_SRC=${LIBINT2_LIBRARY_CXX_SRC}") add_library(int-obj OBJECT "${LIBINT2_LIBRARY_CXX_SRC}") -set_target_properties(int-obj PROPERTIES UNITY_BUILD TRUE) # always use unity build for int-obj target_compile_definitions(int-obj PRIVATE -D__COMPILING_LIBINT2=1) + target_compile_features(int-obj PUBLIC "cxx_std_11") # N.B. PUBLIC to make int-{static/shared} require C++11? +set_target_properties(int-obj PROPERTIES UNITY_BUILD TRUE) # always use unity build for int-obj + +if (MSVC) + # Increase stack size from 1 MB to 4 MB + set_target_properties(int-obj PROPERTIES LINK_FLAGS "/STACK:4194304") +endif() + target_include_directories(int-obj PRIVATE ${PROJECT_BINARY_DIR}/include/ ${PROJECT_SOURCE_DIR}/src/ ${PROJECT_SOURCE_DIR}/include/ @@ -196,141 +195,261 @@ target_include_directories(int-obj PRIVATE ${PROJECT_BINARY_DIR}/include/ ) if(BUILD_SHARED_LIBS OR LIBINT2_BUILD_SHARED_AND_STATIC_LIBS) - set_target_properties(int-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) + set(BUILD_SHARED_LIBS 1) + set_target_properties(int-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) endif() if (NOT BUILD_SHARED_LIBS OR LIBINT2_BUILD_SHARED_AND_STATIC_LIBS) - set(BUILD_STATIC_LIBS 1) + set(BUILD_STATIC_LIBS 1) endif() -# if building CXX API make an object files needed for non-header-only version -if (REQUIRE_CXX_API) - add_library(int-cxx-obj OBJECT src/engine.cpp) - target_compile_definitions(int-cxx-obj PUBLIC LIBINT2_DOES_NOT_INLINE_ENGINE=1 __COMPILING_LIBINT2=1) - target_link_libraries (int-cxx-obj PRIVATE libint-Eigen3) - if (TARGET Boost::boost) - target_link_libraries (int-cxx-obj PRIVATE Boost::boost) - endif(TARGET Boost::boost) - target_compile_features(int-cxx-obj PUBLIC "cxx_std_11") - target_include_directories(int-cxx-obj PRIVATE ${PROJECT_BINARY_DIR}/include/ - ${PROJECT_SOURCE_DIR}/src/ - ${PROJECT_SOURCE_DIR}/include/ - ${PROJECT_BINARY_DIR}/include/libint2/ - ) - if(BUILD_SHARED_LIBS OR LIBINT2_BUILD_SHARED_AND_STATIC_LIBS) - set_target_properties(int-cxx-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) - endif() -endif() +# if building CXX API, make an object lib needed for non-header-only version +if (REQUIRE_CXX_API_COMPILED) + add_library(int-cxx-compiled-obj OBJECT src/engine.cpp) -if (MSVC) - # Increase stack size from 1 MB to 4 MB - set_target_properties(int-obj PROPERTIES LINK_FLAGS "/STACK:4194304") + target_compile_definitions( + int-cxx-compiled-obj + PUBLIC + LIBINT2_DOES_NOT_INLINE_ENGINE=1 + __COMPILING_LIBINT2=1 + ) + + target_compile_features(int-cxx-compiled-obj PUBLIC "cxx_std_11") + + if (BUILD_SHARED_LIBS) + set_target_properties(int-cxx-compiled-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) + endif() + + if(MSVC) + # MSVC does not include constants, unless _USE_MATH_DEFINES is defined. + target_compile_definitions(int-cxx-compiled-obj PUBLIC _USE_MATH_DEFINES) + # Set the exception handling model + target_compile_options(int-cxx-compiled-obj PUBLIC "/EHsc") + endif() + + target_include_directories( + int-cxx-compiled-obj + PRIVATE + ${PROJECT_BINARY_DIR}/include/ + ${PROJECT_SOURCE_DIR}/src/ + ${PROJECT_SOURCE_DIR}/include/ + ${PROJECT_BINARY_DIR}/include/libint2/ + ) + + target_link_libraries(int-cxx-compiled-obj PRIVATE Eigen3::Eigen) + if (TARGET Boost::headers) + target_link_libraries(int-cxx-compiled-obj PRIVATE Boost::headers) + endif() endif() -get_filename_component(DATADIR_ABSOLUTE "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}" ABSOLUTE) if (BUILD_SHARED_LIBS) - add_library (int-shared SHARED $) - set_target_properties (int-shared PROPERTIES SOVERSION ${LIBINT_MAJOR_SOVERSION} - MACOSX_RPATH ON - OUTPUT_NAME "int2" - EXPORT_NAME "int2") - target_include_directories(int-shared INTERFACE - $ - $ - $ - $ - $) + add_library(int-shared SHARED $) + + if(MSVC) + target_compile_definitions(int-shared PUBLIC _USE_MATH_DEFINES) + target_compile_options(int-shared PUBLIC "/EHsc") + endif() + target_compile_features(int-shared INTERFACE "cxx_std_11") + set_target_properties( + int-shared + PROPERTIES + SOVERSION ${LIBINT_MAJOR_SOVERSION} + MACOSX_RPATH ON + OUTPUT_NAME "int2" + EXPORT_NAME "int2" + ) + if (APPLE) + set_target_properties( + int-shared + PROPERTIES + LINK_FLAGS "-undefined dynamic_lookup" + ) + endif() + if (MSVC) + # necessary but insufficient for dll, https://github.com/evaleev/libint/issues/237 + set_target_properties( + int-shared + PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS ON + ) + endif() + + target_include_directories( + int-shared + INTERFACE + $ + $ + $ + $ + ) + # C++ library if (REQUIRE_CXX_API) - add_library(int-cxx-headeronly-shared INTERFACE) - target_link_libraries (int-cxx-headeronly-shared INTERFACE int-shared libint-Eigen3) - if (TARGET Boost::boost) - target_link_libraries (int-cxx-headeronly-shared INTERFACE Boost::boost) - endif(TARGET Boost::boost) - target_compile_features(int-cxx-headeronly-shared INTERFACE "cxx_std_11") - target_compile_definitions(int-cxx-headeronly-shared INTERFACE + add_library(int-cxx-headeronly-shared INTERFACE) + + target_compile_definitions( + int-cxx-headeronly-shared + INTERFACE $ - $) - set_target_properties (int-cxx-headeronly-shared PROPERTIES EXPORT_NAME "cxx") - - # now make the compiled library - add_library (int-cxx-shared SHARED $) - set_target_properties (int-cxx-shared PROPERTIES SOVERSION ${LIBINT_MAJOR_SOVERSION} - MACOSX_RPATH ON - OUTPUT_NAME "int2-cxx" - EXPORT_NAME "int2-cxx") - target_link_libraries(int-cxx-shared INTERFACE int-cxx-headeronly-shared) + $ + ) + + target_compile_features(int-cxx-headeronly-shared INTERFACE "cxx_std_11") + + set_target_properties(int-cxx-headeronly-shared PROPERTIES EXPORT_NAME "cxx") + + target_link_libraries(int-cxx-headeronly-shared INTERFACE int-shared Eigen3::Eigen) + if (TARGET Boost::headers) + target_link_libraries(int-cxx-headeronly-shared INTERFACE Boost::headers) + endif() + + # now make the compiled library + if (REQUIRE_CXX_API_COMPILED) + add_library(int-cxx-compiled-shared SHARED $) + + if(MSVC) + target_compile_definitions(int-cxx-compiled-shared PUBLIC _USE_MATH_DEFINES) + target_compile_options(int-cxx-compiled-shared PUBLIC "/EHsc") + endif() + + set_target_properties( + int-cxx-compiled-shared + PROPERTIES + SOVERSION ${LIBINT_MAJOR_SOVERSION} + MACOSX_RPATH ON + OUTPUT_NAME "int2-cxx" + EXPORT_NAME "int2-cxx" + ) + if (APPLE) + set_target_properties( + int-cxx-compiled-shared + PROPERTIES + LINK_FLAGS "-undefined dynamic_lookup" + ) + endif() + if (MSVC) + # necessary but insufficient for dll + set_target_properties( + int-cxx-compiled-shared + PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS ON + ) + endif() + + target_link_libraries(int-cxx-compiled-shared INTERFACE int-cxx-headeronly-shared) + endif() endif() endif() if (BUILD_STATIC_LIBS) - add_library (int-static STATIC $) - set_target_properties (int-static PROPERTIES OUTPUT_NAME "int2" - EXPORT_NAME "int2") - target_include_directories(int-static INTERFACE - $ - $ - $ - $ - $) + add_library(int-static STATIC $) + target_compile_features(int-static INTERFACE "cxx_std_11") + if(MSVC) + target_compile_definitions(int-static PUBLIC _USE_MATH_DEFINES) + target_compile_options(int-static PUBLIC "/EHsc") + endif() + + set_target_properties( + int-static + PROPERTIES + OUTPUT_NAME "int2" + EXPORT_NAME "int2" + ) + + target_include_directories( + int-static + INTERFACE + $ + $ + $ + $ + ) + # C++ library if (REQUIRE_CXX_API) - add_library(int-cxx-headeronly-static INTERFACE) - target_link_libraries (int-cxx-headeronly-static INTERFACE int-static libint-Eigen3) - if (TARGET Boost::boost) - target_link_libraries (int-cxx-headeronly-static INTERFACE Boost::boost) - endif(TARGET Boost::boost) - target_compile_features(int-cxx-headeronly-static INTERFACE "cxx_std_11") - target_compile_definitions(int-cxx-headeronly-static INTERFACE + add_library(int-cxx-headeronly-static INTERFACE) + + target_compile_definitions( + int-cxx-headeronly-static + INTERFACE $ - $) - set_target_properties (int-cxx-headeronly-static PROPERTIES EXPORT_NAME "cxx") - - # now make the compiled library - add_library (int-cxx-static STATIC $) - set_target_properties (int-cxx-static PROPERTIES OUTPUT_NAME "int2-cxx" - EXPORT_NAME "int2-cxx") - target_link_libraries(int-cxx-static INTERFACE int-cxx-headeronly-static) - endif(REQUIRE_CXX_API) + $ + ) + + target_compile_features(int-cxx-headeronly-static INTERFACE "cxx_std_11") + + set_target_properties(int-cxx-headeronly-static PROPERTIES EXPORT_NAME "cxx") + + target_link_libraries(int-cxx-headeronly-static INTERFACE int-static Eigen3::Eigen) + if (TARGET Boost::headers) + target_link_libraries(int-cxx-headeronly-static INTERFACE Boost::headers) + endif() + + # now make the compiled library + if (REQUIRE_CXX_API_COMPILED) + add_library(int-cxx-compiled-static STATIC $) + + if(MSVC) + target_compile_definitions(int-cxx-compiled-static PUBLIC _USE_MATH_DEFINES) + target_compile_options(int-cxx-compiled-static PUBLIC "/EHsc") + endif() + + set_target_properties( + int-cxx-compiled-static + PROPERTIES + OUTPUT_NAME "int2-cxx" + EXPORT_NAME "int2-cxx" + ) + + target_link_libraries(int-cxx-compiled-static INTERFACE int-cxx-headeronly-static) + endif() + endif() endif() +# Permanent aliases ==================================================================================================== +# * make Libint2:: targets available for both `add_subdirectory(Libint2)` & `find_package(Libint2)` approaches +# * used for tests + if (BUILD_SHARED_LIBS) - add_library (int-library ALIAS int-shared) - if (TARGET int-cxx-shared) - add_library (int-cxx-library ALIAS int-cxx-shared) - endif(TARGET int-cxx-shared) + add_library(${L2}::int2 ALIAS int-shared) + if (REQUIRE_CXX_API) + add_library(${L2}::cxx ALIAS int-cxx-headeronly-shared) + if (REQUIRE_CXX_API_COMPILED) + add_library(${L2}::int2-cxx ALIAS int-cxx-compiled-shared) + endif() + endif() elseif (BUILD_STATIC_LIBS) - add_library (int-library ALIAS int-static) - if (TARGET int-cxx-static) - add_library (int-cxx-library ALIAS int-cxx-static) - endif(TARGET int-cxx-static) + add_library(${L2}::int2 ALIAS int-static) + if (REQUIRE_CXX_API) + add_library(${L2}::cxx ALIAS int-cxx-headeronly-static) + if (REQUIRE_CXX_API_COMPILED) + add_library(${L2}::int2-cxx ALIAS int-cxx-compiled-static) + endif() + endif() endif() # Legacy (pre-2.7.0) aliases =========================================================================================== + if (BUILD_SHARED_LIBS) - add_library (libint2 ALIAS int-shared) - add_library (Libint2::int2 ALIAS int-shared) - if (TARGET int-cxx-shared) - add_library (libint2_cxx ALIAS int-cxx-shared) - add_library (Libint2::cxx ALIAS int-cxx-shared) - endif(TARGET int-cxx-shared) + add_library(libint2 ALIAS int-shared) + if (REQUIRE_CXX_API) + add_library(libint2_cxx ALIAS int-cxx-headeronly-shared) + endif() elseif (BUILD_STATIC_LIBS) - add_library (libint2 ALIAS int-static) - add_library (Libint2::int2 ALIAS int-static) - if (TARGET int-cxx-static) - add_library (libint2_cxx ALIAS int-cxx-static) - add_library (Libint2::cxx ALIAS int-cxx-static) - endif(TARGET int-cxx-static) + add_library(libint2 ALIAS int-static) + if (REQUIRE_CXX_API) + add_library(libint2_cxx ALIAS int-cxx-headeronly-static) + endif() endif() # Fortran bindings ===================================================================================================== if (ENABLE_FORTRAN) # specify the location of modules - set(CMAKE_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/fortran/modules/") + set(BUILDTREE_FMODDIR "fortran/modules") # preprocess libint2.h ... this is a guess for UNIX systems only # N.B. Requires C compiler! @@ -342,9 +461,9 @@ if (ENABLE_FORTRAN) check_language(C) if (CMAKE_C_COMPILER) enable_language(C) - else(CMAKE_C_COMPILER) + else() message(FATAL_ERROR "Given ENABLE_FORTRAN=ON but could not find C compiler needed to generate Fortran bindings, provide via CMAKE_C_COMPILER") - endif(CMAKE_C_COMPILER) + endif() # preprocessed libint.h add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/fortran/libint2.h.i @@ -359,113 +478,257 @@ if (ENABLE_FORTRAN) # translated Libint_t add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/fortran/libint2_types_f.h - COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/fortran/c_to_f.py ${PROJECT_BINARY_DIR}/fortran/libint2.h.i ${PROJECT_BINARY_DIR}/fortran/libint2_types_f.h Libint_t + COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/fortran/c_to_f.py ${PROJECT_BINARY_DIR}/fortran/libint2.h.i ${PROJECT_BINARY_DIR}/fortran/libint2_types_f.h Libint_t DEPENDS ${PROJECT_BINARY_DIR}/fortran/libint2.h.i COMMENT "Generating libint2_types_f.h" ) # extracted defines from libint2_types.h add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/fortran/fortran_incldefs.h - COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/fortran/make_defs.py ${PROJECT_SOURCE_DIR}/src/libint2_types.h ${PROJECT_BINARY_DIR}/fortran/fortran_incldefs.h + COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/fortran/make_defs.py ${PROJECT_SOURCE_DIR}/src/libint2_types.h ${PROJECT_BINARY_DIR}/fortran/fortran_incldefs.h DEPENDS ${PROJECT_SOURCE_DIR}/src/libint2_types.h COMMENT "Generating fortran_incldefs.h" ) # build module add_library(libint_f OBJECT fortran/libint_f.F90) + set_source_files_properties(fortran/libint_f.F90 PROPERTIES OBJECT_DEPENDS "${PROJECT_BINARY_DIR}/fortran/libint2_types_f.h;${PROJECT_BINARY_DIR}/fortran/fortran_incldefs.h") + target_compile_definitions(libint_f PRIVATE __COMPILING_LIBINT2) + + set_target_properties( + libint_f + PROPERTIES + Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/${BUILDTREE_FMODDIR} + ) + if (BUILD_SHARED_LIBS) + set_target_properties(libint_f PROPERTIES POSITION_INDEPENDENT_CODE 1) + endif() + target_include_directories(libint_f PUBLIC $ $ $ $ - $) - target_compile_definitions(libint_f PRIVATE __COMPILING_LIBINT2) - set_property(TARGET libint_f PROPERTY Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/fortran/modules) + $ + $) # Fortran tests merged into rest of tests # install Fortran modules - install(DIRECTORY "${CMAKE_Fortran_MODULE_DIRECTORY}" - COMPONENT fortran - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" - ) + install( + DIRECTORY + "${PROJECT_BINARY_DIR}/${BUILDTREE_FMODDIR}/" + COMPONENT "${L2}_Development_Fortran" + DESTINATION "${LIBINT2_INSTALL_FMODDIR}" + ) + + install( + TARGETS + libint_f + EXPORT fshared_set + RUNTIME + COMPONENT ${L2}_Runtime + LIBRARY + COMPONENT ${L2}_Runtime + NAMELINK_COMPONENT ${L2}_Development + ARCHIVE + COMPONENT ${L2}_Development + PUBLIC_HEADER + COMPONENT ${L2}_Development + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) -endif(ENABLE_FORTRAN) +endif() # <<< Install >>> -install(DIRECTORY ${PROJECT_BINARY_DIR}/include/ - ${PROJECT_SOURCE_DIR}/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - FILES_MATCHING PATTERN "*.h" - PATTERN "*.hpp") - -install(FILES ${PROJECT_SOURCE_DIR}/src/libint2_iface.h - ${PROJECT_SOURCE_DIR}/src/libint2_iface_internal.h - ${PROJECT_SOURCE_DIR}/src/libint2_params.h - ${PROJECT_SOURCE_DIR}/src/libint2_types.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libint2) - -#target_include_directories(int-obj PRIVATE ${PROJECT_BINARY_DIR}) +install( + DIRECTORY + ${PROJECT_BINARY_DIR}/include/ + ${PROJECT_SOURCE_DIR}/include/ + TYPE INCLUDE + COMPONENT ${L2}_Development + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.hpp" + ) + +install( + FILES + ${PROJECT_SOURCE_DIR}/src/libint2_iface.h + ${PROJECT_SOURCE_DIR}/src/libint2_iface_internal.h + ${PROJECT_SOURCE_DIR}/src/libint2_params.h + ${PROJECT_SOURCE_DIR}/src/libint2_types.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libint2 + COMPONENT ${L2}_Development + ) if (BUILD_SHARED_LIBS) - install (TARGETS int-shared - EXPORT "${pnv}-targets-shared" - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - if (TARGET int-cxx-headeronly-shared AND TARGET int-cxx-shared) - install (TARGETS int-cxx-headeronly-shared int-cxx-shared - EXPORT "${pnv}-targets-shared" - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + if (TARGET int-cxx-compiled-shared) + set(tgts int-shared int-cxx-headeronly-shared int-cxx-compiled-shared) + elseif (TARGET int-cxx-headeronly-shared) + set(tgts int-shared int-cxx-headeronly-shared) + else() + set(tgts int-shared) endif() + + install( + TARGETS + ${tgts} + EXPORT shared_set + RUNTIME + COMPONENT ${L2}_Runtime + LIBRARY + COMPONENT ${L2}_Runtime + NAMELINK_COMPONENT ${L2}_Development + ARCHIVE + COMPONENT ${L2}_Development + PUBLIC_HEADER + COMPONENT ${L2}_Development + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) endif() if (BUILD_STATIC_LIBS) - install (TARGETS int-static - EXPORT "${pnv}-targets-static" - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - if (TARGET int-cxx-headeronly-static AND TARGET int-cxx-static) - install (TARGETS int-cxx-headeronly-static int-cxx-static - EXPORT "${pnv}-targets-static" - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + if (TARGET int-cxx-compiled-static) + set(tgts int-static int-cxx-headeronly-static int-cxx-compiled-static) + elseif (TARGET int-cxx-headeronly-static) + set(tgts int-static int-cxx-headeronly-static) + else() + set(tgts int-static) endif() + + install( + TARGETS + ${tgts} + EXPORT static_set + RUNTIME + COMPONENT ${L2}_Runtime + LIBRARY + COMPONENT ${L2}_Runtime + NAMELINK_COMPONENT ${L2}_Development + ARCHIVE + COMPONENT ${L2}_Development + PUBLIC_HEADER + COMPONENT ${L2}_Development + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) +endif() + +if (LIBINT_LOCAL_Eigen3_INSTALL AND TARGET Eigen3::Eigen) + + add_library(Eigen INTERFACE) + foreach(prop + INTERFACE_INCLUDE_DIRECTORIES + INTERFACE_COMPILE_DEFINITIONS + INTERFACE_COMPILE_OPTIONS + INTERFACE_LINK_LIBRARIES + INTERFACE_POSITION_INDEPENDENT_CODE + ) + get_property(_propval TARGET Eigen3::Eigen PROPERTY ${prop}) + set_property(TARGET Eigen PROPERTY ${prop} ${_propval}) + endforeach() + + install( + TARGETS + Eigen + EXPORT local_set + LIBRARY + COMPONENT ${L2}_Eigen3 + NAMELINK_COMPONENT ${L2}_Eigen3 + ARCHIVE + COMPONENT ${L2}_Eigen3 + PUBLIC_HEADER + COMPONENT ${L2}_Eigen3 + ) endif() # install basis set library -install(DIRECTORY ${PROJECT_SOURCE_DIR}/lib/basis - DESTINATION "${CMAKE_INSTALL_DATADIR}" - ) +install( + DIRECTORY ${PROJECT_SOURCE_DIR}/lib/basis + DESTINATION "${LIBINT2_INSTALL_BASISDIR}" + COMPONENT ${L2}_Development + ) if (BUILD_TESTING) - enable_testing(true) add_subdirectory(tests) endif() # <<< Export Config >>> -# GNUInstallDirs "DATADIR" wrong here; CMake search path wants "share". -configure_package_config_file(cmake/${pnv}-config.cmake.in - "${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config.cmake" - INSTALL_DESTINATION ${CMAKE_INSTALL_CMAKEDIR}) +configure_package_config_file( + cmake/${pnv}-config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config.cmake" + INSTALL_DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} + NO_SET_AND_CHECK_MACRO + ) write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config-version.cmake VERSION ${LIBINT_VERSION} COMPATIBILITY SameMajorVersion) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config-version.cmake - DESTINATION ${CMAKE_INSTALL_CMAKEDIR}) +install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config-version.cmake + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/FindEigen3.cmake + DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} + COMPONENT ${L2}_Development + ) + +include(JoinPaths) +join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}") +join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") configure_file(cmake/libint2.pc.cmake.in libint2.pc @ONLY) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libint2.pc - DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/) +if (NOT MSVC) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libint2.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ + COMPONENT ${L2}_Development + ) +endif() if (BUILD_SHARED_LIBS) - install(EXPORT "${pnv}-targets-shared" - NAMESPACE "${NS}::" - DESTINATION ${CMAKE_INSTALL_CMAKEDIR}) + install( + EXPORT shared_set + FILE "${pnv}-targets-shared.cmake" + NAMESPACE "${L2}::" + DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} + COMPONENT ${L2}_Development + ) endif() if (BUILD_STATIC_LIBS) - install(EXPORT "${pnv}-targets-static" - NAMESPACE "${NS}::" - DESTINATION ${CMAKE_INSTALL_CMAKEDIR}) + install( + EXPORT static_set + FILE "${pnv}-targets-static.cmake" + NAMESPACE "${L2}::" + DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} + COMPONENT ${L2}_Development + ) endif() + +if (LIBINT_LOCAL_Eigen3_INSTALL AND TARGET Eigen3::Eigen) + install( + EXPORT local_set + FILE "${pnv}-targets-eigen3.cmake" + NAMESPACE "${L2}::" + DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} + COMPONENT ${L2}_Eigen3 + ) +endif() + +# not much point in exporting Fortran since it's a simple int2+includes+flags and +# those includes are compiler-version dependent, but this is the setup. +# note that FILE something like "fortran-shared" NOT "shared-fortran" or the glob +# confused with shared_set +# +# if(ENABLE_FORTRAN) +# install( +# EXPORT fshared_set +# FILE "${pnv}-targets-fortran-shared.cmake" +# NAMESPACE "${L2}::" +# DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} +# COMPONENT ${L2}_Development_Fortran +# ) +# endif() diff --git a/src/lib/libint/LICENSE.export b/src/lib/libint/LICENSE.export index b017547b2..9b9747665 100644 --- a/src/lib/libint/LICENSE.export +++ b/src/lib/libint/LICENSE.export @@ -1,6 +1,6 @@ Libint - a library for the evaluation of molecular integrals of many-body operators over Gaussian functions -Copyright (C) 2004-2020 Edward F. Valeev +Copyright (C) 2004-2021 Edward F. Valeev Libint is free software. The generated Libint library can be distributed under the GNU Lesser General Public License, version 3, (see files COPYING.LESSER and COPYING, diff --git a/src/lib/libint/features.in b/src/lib/libint/features.in index a9a117811..b8ecd503c 100644 --- a/src/lib/libint/features.in +++ b/src/lib/libint/features.in @@ -1,7 +1,7 @@ LIBINT_SUPPORTS_ONEBODY = @LIBINT_SUPPORTS_ONEBODY@ LIBINT_ONEBODY_DERIV = @LIBINT_ONEBODY_DERIV@ LIBINT_SUPPORTS_ERI = @LIBINT_SUPPORTS_ERI@ -LIBINT_ERI_MAX_AM = @ERI_MAX_AM@ +LIBINT_ERI_MAX_AM = @Libint2_ERI_MAX_AM@ LIBINT_ERI_DERIV = @LIBINT_ERI_DERIV@ LIBINT_CONTRACTED_INTS = @LIBINT_CONTRACTED_INTS@ LIBINT_SHELL_SET = @LIBINT_SHELL_SET@ diff --git a/src/lib/libint/populate.cmake b/src/lib/libint/populate.cmake index e39ec5574..767a00e02 100644 --- a/src/lib/libint/populate.cmake +++ b/src/lib/libint/populate.cmake @@ -1,6 +1,6 @@ set(LIBRARY_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src/lib/libint) configure_file("${LIBRARY_SOURCE_DIR}/LICENSE.export" "${EXPORT_STAGE_DIR}/LICENSE" COPYONLY) -configure_file("${LIBRARY_SOURCE_DIR}/INSTALL.export" +configure_file("${PROJECT_SOURCE_DIR}/INSTALL.md" "${EXPORT_STAGE_DIR}/INSTALL" COPYONLY) file(INSTALL "${PROJECT_SOURCE_DIR}/COPYING" @@ -50,9 +50,12 @@ file(INSTALL "${PROJECT_SOURCE_DIR}/external/boost.tar.gz" file(INSTALL "${PROJECT_SOURCE_DIR}/cmake/modules/autocmake_safeguards.cmake" "${PROJECT_SOURCE_DIR}/cmake/modules/int_orderings.cmake" "${PROJECT_SOURCE_DIR}/cmake/modules/options.cmake" - "${PROJECT_SOURCE_DIR}/cmake/modules/FindMPFR.cmake" + "${PROJECT_SOURCE_DIR}/cmake/modules/FindMultiprecision.cmake" "${PROJECT_SOURCE_DIR}/cmake/modules/AddCustomTargetSubproject.cmake" + "${PROJECT_SOURCE_DIR}/cmake/modules/FindEigen3.cmake" + "${PROJECT_SOURCE_DIR}/cmake/modules/JoinPaths.cmake" "${PROJECT_BINARY_DIR}/cmake/modules/int_computed.cmake" + "${PROJECT_SOURCE_DIR}/cmake/modules/xhost.cmake" DESTINATION "${EXPORT_STAGE_DIR}/cmake/modules") file(INSTALL "${PROJECT_SOURCE_DIR}/cmake/libint2-config.cmake.in" diff --git a/src/lib/libint/tests/CMakeLists.txt b/src/lib/libint/tests/CMakeLists.txt index c1622ee15..a11cca6a4 100644 --- a/src/lib/libint/tests/CMakeLists.txt +++ b/src/lib/libint/tests/CMakeLists.txt @@ -2,25 +2,29 @@ include(AddCustomTargetSubproject) add_custom_target_subproject(libint2 check USES_TERMINAL COMMAND ${CMAKE_CTEST_COMMAND} -V -R "libint2/") add_executable(eritest-libint2 EXCLUDE_FROM_ALL eri/test.cc) -target_link_libraries(eritest-libint2 int-library) # N.B. plain library +target_link_libraries(eritest-libint2 Libint2::int2) # N.B. plain library target_include_directories(eritest-libint2 PRIVATE eri ${CMAKE_CURRENT_BINARY_DIR}/../include) target_compile_definitions(eritest-libint2 PRIVATE -D__COMPILING_LIBINT2=1) -if (TARGET MPFR::MPFRXX) +if (TARGET Multiprecision::mpfr) target_compile_definitions(eritest-libint2 PRIVATE -DLIBINT_HAS_MPFR=1) - target_link_libraries(eritest-libint2 PRIVATE MPFR::MPFRXX) -endif(TARGET MPFR::MPFRXX) + target_link_libraries(eritest-libint2 Multiprecision::mpfr) +endif() +# Test 1 add_test(libint2/eritest/build ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target eritest-libint2) set_tests_properties(libint2/eritest/build PROPERTIES FIXTURES_SETUP LIBINT2_ERITEST_EXEC) +# Test 2 add_test(NAME libint2/eritest/run0 COMMAND $ 0 2) set_tests_properties(libint2/eritest/run0 PROPERTIES FIXTURES_REQUIRED LIBINT2_ERITEST_EXEC) +# Test 3 add_test(NAME libint2/eritest/run1 COMMAND $ 1 1) set_tests_properties(libint2/eritest/run1 PROPERTIES FIXTURES_REQUIRED LIBINT2_ERITEST_EXEC) +# Test 4 add_test(NAME libint2/eritest/run2 COMMAND $ 2 1) set_tests_properties(libint2/eritest/run2 @@ -46,32 +50,36 @@ if (LIBINT_HAS_CXX_API) unit/c-api-util.cc unit/test-c-api.cc ) - endif(CMAKE_C_COMPILER) + endif() add_executable(unit_tests-libint2 EXCLUDE_FROM_ALL ${unit_tests-src}) - target_link_libraries(unit_tests-libint2 int-cxx-library) # N.B. cxx library + target_link_libraries(unit_tests-libint2 Libint2::cxx) # N.B. cxx header-only library target_include_directories(unit_tests-libint2 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../include) target_compile_definitions(unit_tests-libint2 PRIVATE -D__COMPILING_LIBINT2=1) - if (TARGET MPFR::MPFRXX) + if (TARGET Multiprecision::mpfr) target_compile_definitions(unit_tests-libint2 PRIVATE -DLIBINT_HAS_MPFR=1) - target_link_libraries(unit_tests-libint2 PRIVATE MPFR::MPFRXX) - endif(TARGET MPFR::MPFRXX) + target_link_libraries(unit_tests-libint2 Multiprecision::mpfr) + endif() + # Test 5 add_test(libint2/unit/build "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target unit_tests-libint2) set_tests_properties(libint2/unit/build PROPERTIES FIXTURES_SETUP LIBINT2_UNIT_TESTS_EXEC) + # Test 6 add_test(NAME libint2/unit/run COMMAND $) set_tests_properties(libint2/unit/run PROPERTIES FIXTURES_REQUIRED LIBINT2_UNIT_TESTS_EXEC) add_executable(hf-libint2 EXCLUDE_FROM_ALL hartree-fock/hartree-fock.cc) - target_link_libraries(hf-libint2 int-cxx-library) # N.B. cxx library + target_link_libraries(hf-libint2 Libint2::cxx) # N.B. cxx library target_include_directories(hf-libint2 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../include) target_compile_definitions(hf-libint2 PRIVATE -D__COMPILING_LIBINT2=1) + # Test 7 add_test(libint2/hf/build "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target hf-libint2) set_tests_properties(libint2/hf/build PROPERTIES FIXTURES_SETUP LIBINT2_HFTEST_EXEC) - if (PYTHONINTERP_FOUND) + if (Python_Interpreter_FOUND) + # Test 8 add_test(NAME libint2/hf/run COMMAND ${CMAKE_COMMAND} -DexecName=hf-libint2 @@ -79,24 +87,27 @@ if (LIBINT_HAS_CXX_API) -DtestArgs=${PROJECT_SOURCE_DIR}/tests/hartree-fock/h2o.xyz -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} -DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR} - -DpythonExec=${PYTHON_EXECUTABLE} + -DpythonExec=${Python_EXECUTABLE} -P ${PROJECT_SOURCE_DIR}/tests/hartree-fock/hftest.cmake) else() + # Test 8 alt. add_test(NAME libint2/hf/run - COMMAND $ hartree-fock/h2o.xyz) + COMMAND $ hartree-fock/h2o.xyz) endif() set_tests_properties(libint2/hf/run PROPERTIES FIXTURES_REQUIRED LIBINT2_HFTEST_EXEC) find_package(Threads) # for some reason clang does not link in threading support even though we are using C++ threads add_executable(hf++-libint2 EXCLUDE_FROM_ALL hartree-fock/hartree-fock++.cc) - target_link_libraries(hf++-libint2 int-cxx-library ${CMAKE_THREAD_LIBS_INIT}) # N.B. cxx library + target_link_libraries(hf++-libint2 Libint2::cxx ${CMAKE_THREAD_LIBS_INIT}) # N.B. cxx library target_include_directories(hf++-libint2 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../include) target_compile_definitions(hf++-libint2 PRIVATE -D__COMPILING_LIBINT2=1) + # Test 9 add_test(libint2/hf++/build "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target hf++-libint2) set_tests_properties(libint2/hf++/build PROPERTIES FIXTURES_SETUP LIBINT2_HFXXTEST_EXEC) - if (PYTHONINTERP_FOUND) + if (Python_Interpreter_FOUND) + # Test 10 add_test(NAME libint2/hf++/run COMMAND ${CMAKE_COMMAND} -DexecName=hf++-libint2 @@ -104,27 +115,32 @@ if (LIBINT_HAS_CXX_API) -DtestArgs=${PROJECT_SOURCE_DIR}/tests/hartree-fock/h2o_rotated.xyz -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} -DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR} - -DpythonExec=${PYTHON_EXECUTABLE} + -DpythonExec=${Python_EXECUTABLE} -P ${PROJECT_SOURCE_DIR}/tests/hartree-fock/hftest.cmake) else() + # Test 10 alt. add_test(NAME libint2/hf++/run COMMAND $ hartree-fock/h2o_rotated.xyz) endif() set_tests_properties(libint2/hf++/run PROPERTIES FIXTURES_REQUIRED LIBINT2_HFXXTEST_EXEC) -endif (LIBINT_HAS_CXX_API) +endif() if (ENABLE_FORTRAN) + # Note: if forming compile line by hand rather than using targets, you'll need to include the Fortran module file directory: + # `target_include_directories(... PRIVATE $)` + # tests add_executable(fortran_example-libint2 EXCLUDE_FROM_ALL fortran/fortran_example.F90) - target_link_libraries(fortran_example-libint2 libint2 libint_f) - target_include_directories(fortran_example-libint2 PRIVATE $) + target_link_libraries(fortran_example-libint2 Libint2::int2 libint_f) target_compile_definitions(fortran_example-libint2 PRIVATE -D__COMPILING_LIBINT2=1) + # Test 11 add_test(libint2/fortran_example/build "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target fortran_example-libint2) set_tests_properties(libint2/fortran_example/build PROPERTIES FIXTURES_SETUP LIBINT2_FORTRAN_EXAMPLE_EXEC) + # Test 12 add_test(NAME libint2/fortran_example/run COMMAND $) set_tests_properties(libint2/fortran_example/run @@ -132,16 +148,17 @@ if (ENABLE_FORTRAN) if (LIBINT_HAS_CXX_API) add_executable(fortran_test-libint2 EXCLUDE_FROM_ALL fortran/test.cc fortran/test-eri.cc $) - target_link_libraries(fortran_test-libint2 libint2_cxx libint_f) - target_include_directories(fortran_test-libint2 PRIVATE $) + target_link_libraries(fortran_test-libint2 Libint2::cxx libint_f) target_compile_definitions(fortran_test-libint2 PRIVATE -D__COMPILING_LIBINT2=1) + # Test 13 add_test(libint2/fortran_test/build "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target fortran_test-libint2) set_tests_properties(libint2/fortran_test/build PROPERTIES FIXTURES_SETUP LIBINT2_FORTRAN_TEST_EXEC) + # Test 14 add_test(NAME libint2/fortran_test/run COMMAND $) set_tests_properties(libint2/fortran_test/run PROPERTIES FIXTURES_REQUIRED LIBINT2_FORTRAN_TEST_EXEC) - endif (LIBINT_HAS_CXX_API) + endif() -endif (ENABLE_FORTRAN) +endif() diff --git a/src/lib/libint/tests/eri/test.cc b/src/lib/libint/tests/eri/test.cc index ff4d633ad..63896bae1 100644 --- a/src/lib/libint/tests/eri/test.cc +++ b/src/lib/libint/tests/eri/test.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2020 Edward F. Valeev + * Copyright (C) 2004-2021 Edward F. Valeev * * This file is part of Libint. * diff --git a/src/lib/libint/tests/fortran/test-eri.cc b/src/lib/libint/tests/fortran/test-eri.cc index a046403e3..efcd6ecef 100644 --- a/src/lib/libint/tests/fortran/test-eri.cc +++ b/src/lib/libint/tests/fortran/test-eri.cc @@ -437,7 +437,7 @@ bool test_eri_c_f(int &contrdepth, int &am1, double *c1, double *alpha1, double for(int d=0; d threshold) { + if(abs_error > threshold) { std::cout << std::setprecision(17) << "Elem " << nel << " di= " << deriv_order << ", : C = " << *eri_shell_set_c << ", Fortran = " << *eri_shell_set_f @@ -480,6 +480,8 @@ bool test_eri_c_f(int &contrdepth, int &am1, double *c1, double *alpha1, double TEST_CASE("Fortran ERI", "[eri]") { + std::srand(1973); + // recipe from eri/test.cc const double ABSOLUTE_DEVIATION_THRESHOLD = 5.0E-14; // indicate failure if any integral differs in absolute sense by more than this // loss of precision in HRR likely limits precision for high-L (e.g. (dp|dd), (dd|dd), etc.) diff --git a/src/lib/libint/tests/fortran/test.cc b/src/lib/libint/tests/fortran/test.cc index 1b0e89484..4b5077a3a 100644 --- a/src/lib/libint/tests/fortran/test.cc +++ b/src/lib/libint/tests/fortran/test.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2020 Edward F. Valeev + * Copyright (C) 2018-2021 Edward F. Valeev * * This file is part of Libint. * diff --git a/src/lib/libint/tests/hartree-fock/hartree-fock++.cc b/src/lib/libint/tests/hartree-fock/hartree-fock++.cc index 0301b1722..3f95c006e 100644 --- a/src/lib/libint/tests/hartree-fock/hartree-fock++.cc +++ b/src/lib/libint/tests/hartree-fock/hartree-fock++.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2020 Edward F. Valeev + * Copyright (C) 2004-2021 Edward F. Valeev * * This file is part of Libint. * diff --git a/src/lib/libint/tests/hartree-fock/hartree-fock.cc b/src/lib/libint/tests/hartree-fock/hartree-fock.cc index 528cfe035..4cbee8ae0 100644 --- a/src/lib/libint/tests/hartree-fock/hartree-fock.cc +++ b/src/lib/libint/tests/hartree-fock/hartree-fock.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2020 Edward F. Valeev + * Copyright (C) 2004-2021 Edward F. Valeev * * This file is part of Libint. * diff --git a/src/lib/libint/tests/unit/test-2body.cc b/src/lib/libint/tests/unit/test-2body.cc index 1d48cc0f8..010d8c0a7 100644 --- a/src/lib/libint/tests/unit/test-2body.cc +++ b/src/lib/libint/tests/unit/test-2body.cc @@ -5,6 +5,8 @@ # include "../eri/eri.h" +typedef unsigned int uint; + TEST_CASE("Slater/Yukawa integrals", "[engine][2-body]") { std::vector obs{ diff --git a/src/lib/libint/tests/unit/test.cc b/src/lib/libint/tests/unit/test.cc index 7727c80c1..2dfeac09d 100644 --- a/src/lib/libint/tests/unit/test.cc +++ b/src/lib/libint/tests/unit/test.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2020 Edward F. Valeev + * Copyright (C) 2018-2021 Edward F. Valeev * * This file is part of Libint. * diff --git a/tests/eri/prep_libint2.h b/tests/eri/prep_libint2.h index 9883e10bd..9a91f351a 100644 --- a/tests/eri/prep_libint2.h +++ b/tests/eri/prep_libint2.h @@ -39,8 +39,7 @@ struct RandomShellSet { std::copy(am, am+N, l); - std::random_device rd; - std::mt19937 rng(rd()); // produces randomness out of thin air + std::mt19937 rng(std::rand()); std::uniform_real_distribution<> rdist(0.1, 3.0); // distribution that maps to 0.1 .. 3.0 auto die = [&rng, &rdist]() -> double { return rdist(rng); }; // glues randomness with mapping diff --git a/tests/eri/test.cc b/tests/eri/test.cc index abde6a161..c19872fff 100644 --- a/tests/eri/test.cc +++ b/tests/eri/test.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2020 Edward F. Valeev + * Copyright (C) 2004-2021 Edward F. Valeev * * This file is part of Libint. *