From f9fd25c3a44eaf3ae8f50f8d60d2e15d869be838 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 13 Jan 2022 11:23:56 -0500 Subject: [PATCH 001/182] int_am.cmake work to allow arbitrary deriv, new components format, more validation. start INSTALL.md option documentation. --- CMakeLists.txt | 28 ++-- INSTALL.md | 42 +++++ cmake/modules/int_am.cmake | 265 ++++++++++++++++++------------ cmake/modules/int_orderings.cmake | 6 +- 4 files changed, 217 insertions(+), 124 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86930cfc0..f63a8e108 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,8 @@ include(CTest) # defines BUILD_TESTING option # <<< General >>> +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) @@ -77,7 +79,7 @@ option_with_default(ENABLE_FORTRAN "Build Fortran03+ Libint interface (requires 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 @@ -133,41 +135,41 @@ 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: (libint_max_am/2)+1)" -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" -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) + Can specify values for each derivative level as a semicolon-separated string" -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) + 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 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" -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" -1) option_with_default(WITH_G12_MAX_AM "Support integrals for G12 methods of angular momentum up to N." -1) @@ -302,4 +304,4 @@ endif() # <<< Install >>> -# nothing to install here \ No newline at end of file +# nothing to install here diff --git a/INSTALL.md b/INSTALL.md index 625a8dcfe..b06192b15 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -13,3 +13,45 @@ For (more) complete instructions please refer to https://github.com/evaleev/libi # Appendix + +#################### + + +----------------------------------------------------------------------------- +## configuring libint compiler + +These are the most useful configure options: + + + +### Which Integrals Classes, Which Derivative Levels + +* `ENABLE_ONEBODY` -- Compile with support for up to N-th derivatives of 1-body integrals. Use -1 for OFF. [Default=0] +* `ENABLE_TWOBODY4` -- Compile with support for up to N-th derivatives of 4-center electron repulsion integrals. Use -1 for OFF. [Default=0] +* `ENABLE_TWOBODY3` -- Compile with support for up to N-th derivatives of 3-center electron repulsion integrals. Use -1 for OFF. [Default=-1] +* `ENABLE_TWOBODY2` -- Compile with support for up to N-th derivatives of 2-center electron repulsion integrals. Use -1 for OFF. [Default=-1] +* `ENABLE_G12` -- Compile with support for N-th derivatives of MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] +* `ENABLE_G12DKH` -- Compile with support for N-th derivatives of DKH-MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] + + +### How High Angular Momentum + +# example for "semicolon-separated string": `-DENABLE_ERI3=2 -DWITH_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" + +* `WITH_MAX_AM` -- Support Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. [Default=4] +* `WITH_OPT_AM` -- 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`] + +### Autotools Update Guide + +* `--enable-eri=N` --> `-D ENABLE_ERI=N` --> `ENABLE_TWOBODY4=N` +* `--disable-eri` --> `-D ENABLE_TWOBODY4=-1` +* `--enable-eri3=N` --> `-D ENABLE_ERI3=N` --> `ENABLE_TWOBODY3=N` +* `--enable-eri2=N` --> `-D ENABLE_ERI2=N` --> `ENABLE_TWOBODY2=N` + +* `--with-max-am=N` --> `-D WITH_MAX_AM=N` +* `--with-max-am=N0,N1,N2` --> `-D WITH_MAX_AM="N0;N1;N2"` (notice commas becoming semicolons and quotes; this is normal 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"` + diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index 94a09ae5d..a9a6182b2 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -8,100 +8,135 @@ # 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)` +# `find_package(Libint2 COMPONENTS twobody_c4_d1_l5)` 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}) +list(SORT _glob_classes_derivs COMPARE NATURAL ORDER DESCENDING) # CMake 3.18 for NATURAL +list(GET _glob_classes_derivs 0 _max_deriv) +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() + + set(_sorted_WITH_MAX_AM ${WITH_MAX_AM}) + list(SORT _sorted_WITH_MAX_AM COMPARE NATURAL ORDER DESCENDING) + list(GET _sorted_WITH_MAX_AM 0 _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}}") # CMake 3.15 for VERBOSE +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) + list(SORT _processed_OPT_AM_LIST COMPARE NATURAL ORDER DESCENDING) + list(GET _processed_OPT_AM_LIST 0 LIBINT_OPT_AM) 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) + list(SORT _processed_OPT_AM_LIST COMPARE NATURAL ORDER DESCENDING) + list(GET _processed_OPT_AM_LIST 0 LIBINT_OPT_AM) + 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 +150,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,22 +221,22 @@ macro(process_integrals_class class) set(${class}_OPT_AM "") else() set(${class}_OPT_AM ${WITH_${class}_OPT_AM}) - - if (${class}_OPT_AM GREATER _max_${class}_MAX_AM) - message(FATAL "Invalid value for ${class}_OPT_AM (${${class}_OPT_AM} !<= ${_max_${class}_MAX_AM}).") - endif() 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})") + 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() process_integrals_class(ONEBODY) -process_integrals_class(ERI2) -process_integrals_class(ERI3) process_integrals_class(ERI) +process_integrals_class(ERI3) +process_integrals_class(ERI2) # discrepancy, as configure doesn't do AM_LIST for these process_integrals_class(G12) @@ -199,15 +244,19 @@ process_integrals_class(G12DKH) # form list of active _ strings to use in Libint2Config set(Libint2_ERI_COMPONENTS "") -foreach(_cls ERI2;ERI3;ERI4) +foreach(_cls ERI;ERI3;ERI2) +# todo use eri4_d0_l2 or eri_c4_d0_l2 string(TOLOWER ${_cls} _lbl) - set(_lbl "${_lbl}_") + #set(_lbl "${_lbl}_") - 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}") +message(STATUS "Library will satisfy ERI AM components: ${Libint2_TWOBODY_COMPONENTS}") 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() From 671a2be77010ca2f315c79811cbb771ab78ea9d9 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 13 Jan 2022 14:34:28 -0500 Subject: [PATCH 002/182] standardize copyright date for new files --- LICENSE | 2 +- include/libint2/config.h.cmake.in | 2 +- include/libint2/config2.h.cmake.in | 2 +- src/lib/libint/LICENSE.export | 2 +- src/lib/libint/tests/eri/test.cc | 2 +- src/lib/libint/tests/fortran/test.cc | 2 +- src/lib/libint/tests/hartree-fock/hartree-fock++.cc | 2 +- src/lib/libint/tests/hartree-fock/hartree-fock.cc | 2 +- src/lib/libint/tests/unit/test.cc | 2 +- tests/eri/test.cc | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) 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/include/libint2/config.h.cmake.in b/include/libint2/config.h.cmake.in index acd00885c..95400f313 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. * 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/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/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.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.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/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. * From 08ad883fccbd4cafef88956e9e929315dc22b9cd Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 02:42:24 -0500 Subject: [PATCH 003/182] misc. fixes --- CMakeLists.txt | 3 ++ INSTALL.md | 53 +++++++++++++++++++++++++--- src/bin/libint/CMakeLists.txt | 2 +- src/lib/libint/CMakeLists.txt.export | 10 +++--- src/lib/libint/tests/CMakeLists.txt | 2 +- 5 files changed, 59 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f63a8e108..048dbed1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,9 @@ option_with_default(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT "[EXPERT] Build generated 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(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 diff --git a/INSTALL.md b/INSTALL.md index b06192b15..f366cb246 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -43,15 +43,58 @@ These are the most useful configure options: * `WITH_MAX_AM` -- Support Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. [Default=4] * `WITH_OPT_AM` -- 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`] +* `WITH_ONEBODY_MAX_AM` -- 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` -- 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_TWOBODY4_MAX_AM` -- 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_TWOBODY4_OPT_AM` -- 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_TWOBODY3_MAX_AM` -- 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_TWOBODY3_OPT_AM` -- 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_TWOBODY2_MAX_AM` -- 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_TWOBODY2_OPT_AM` -- 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`] + + + ### Autotools Update Guide -* `--enable-eri=N` --> `-D ENABLE_ERI=N` --> `ENABLE_TWOBODY4=N` -* `--disable-eri` --> `-D ENABLE_TWOBODY4=-1` -* `--enable-eri3=N` --> `-D ENABLE_ERI3=N` --> `ENABLE_TWOBODY3=N` -* `--enable-eri2=N` --> `-D ENABLE_ERI2=N` --> `ENABLE_TWOBODY2=N` +* `--enable-1body=N` --> `-D ENABLE_ONEBODY` +* `--enable-eri=N` --> `-D ENABLE_ERI=N` --> `-D ENABLE_TWOBODY4=N` +* `--disable-eri` --> `-D ENABLE_ERI=-1` --> `-D ENABLE_TWOBODY4=-1` +* `--enable-eri3=N` --> `-D ENABLE_ERI3=N` --> `-D ENABLE_TWOBODY3=N` +* `--enable-eri2=N` --> `-D ENABLE_ERI2=N` --> `-D ENABLE_TWOBODY2=N` * `--with-max-am=N` --> `-D WITH_MAX_AM=N` -* `--with-max-am=N0,N1,N2` --> `-D WITH_MAX_AM="N0;N1;N2"` (notice commas becoming semicolons and quotes; this is normal CMake list syntax) +* `--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-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` --> `-D WITH_TWOBODY4_MAX_AM=N` +* `--with-eri-max-am=N0,N1,N2` --> `-D WITH_ERI_MAX_AM="N0;N1;N2"` --> `-D WITH_TWOBODY4_MAX_AM="N0;N1;N2"` +* `--with-eri-opt-am=N` --> `-D WITH_ERI_OPT_AM=N` --> `-D WITH_TWOBODY4_OPT_AM=N` +* `--with-eri-opt-am=N0,N1,N2` --> `-D WITH_ERI_OPT_AM="N0;N1;N2"` --> `-D WITH_TWOBODY4_OPT_AM="N0;N1;N2"` + +* `--with-eri3-max-am=N` --> `-D WITH_ERI3_MAX_AM=N` --> `-D WITH_TWOBODY3_MAX_AM=N` +* `--with-eri3-max-am=N0,N1,N2` --> `-D WITH_ERI3_MAX_AM="N0;N1;N2"` --> `-D WITH_TWOBODY3_MAX_AM="N0;N1;N2"` +* `--with-eri3-opt-am=N` --> `-D WITH_ERI3_OPT_AM=N` --> `-D WITH_TWOBODY3_OPT_AM=N` +* `--with-eri3-opt-am=N0,N1,N2` --> `-D WITH_ERI3_OPT_AM="N0;N1;N2"` --> `-D WITH_TWOBODY3_OPT_AM="N0;N1;N2"` + +* `--with-eri2-max-am=N` --> `-D WITH_ERI2_MAX_AM=N` --> `-D WITH_TWOBODY2_MAX_AM=N` +* `--with-eri2-max-am=N0,N1,N2` --> `-D WITH_ERI2_MAX_AM="N0;N1;N2"` --> `-D WITH_TWOBODY2_MAX_AM="N0;N1;N2"` +* `--with-eri2-opt-am=N` --> `-D WITH_ERI2_OPT_AM=N` --> `-D WITH_TWOBODY2_OPT_AM=N` +* `--with-eri2-opt-am=N0,N1,N2` --> `-D WITH_ERI2_OPT_AM="N0;N1;N2"` --> `-D WITH_TWOBODY2_OPT_AM="N0;N1;N2"` + +* `--enable-shared` --> `-D BUILD_SHARED_LIBS=ON` (standard CMake variable) +* `--enable-static` --> `-D BUILD_SHARED_LIBS=OFF` (standard CMake variable) + +* Targets + * `libint2` --> `Libint2::int2` (internal target name `int-shared`) + * `libint2_cxx` --> `Libint2::cxx` (internal target name `int-cxx-shared`) + + diff --git a/src/bin/libint/CMakeLists.txt b/src/bin/libint/CMakeLists.txt index f34421ac7..0915ab27a 100644 --- a/src/bin/libint/CMakeLists.txt +++ b/src/bin/libint/CMakeLists.txt @@ -13,7 +13,7 @@ endif() ### compiler library -add_library(libint-libcompiler +add_library(libint-libcompiler STATIC algebra.cc buildtest.cc class_registry.cc diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 3e364189b..5b863a1ef 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -30,10 +30,12 @@ include(int_computed) 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(ENABLE_FORTRAN "Build Fortran03+ Libint interface (requires C and Fortran and Python)" 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) +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) + if (NOT LIBINT2_REALTYPE) set(LIBINT2_REALTYPE double) endif() @@ -128,8 +130,8 @@ else (TARGET Eigen3::Eigen) 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}") + message(FATAL_ERROR "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() add_library(libint-Eigen3 INTERFACE) set_property(TARGET libint-Eigen3 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIR}) diff --git a/src/lib/libint/tests/CMakeLists.txt b/src/lib/libint/tests/CMakeLists.txt index c1622ee15..6bfe9604c 100644 --- a/src/lib/libint/tests/CMakeLists.txt +++ b/src/lib/libint/tests/CMakeLists.txt @@ -83,7 +83,7 @@ if (LIBINT_HAS_CXX_API) -P ${PROJECT_SOURCE_DIR}/tests/hartree-fock/hftest.cmake) else() 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) From 74389adfc1d31e6effc2395be6e1efa219128da1 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 12:55:28 -0500 Subject: [PATCH 004/182] fill out options descriptions. simpler cmake if/else/endif syntax. --- CMakeLists.txt | 26 ++++++++-------- src/lib/libint/CMakeLists.txt.export | 45 +++++++++++++++------------- 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 048dbed1a..a4e91c958 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,42 +147,42 @@ 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 level 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 level 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 level 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). + "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 level 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 level 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 level 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 level 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 >>> diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 5b863a1ef..63d4ef0f7 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -46,7 +46,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() @@ -124,7 +124,7 @@ if (TARGET Eigen3::Eigen) set_property(TARGET libint-Eigen3 PROPERTY ${prop} ${EIGEN3_${prop}}) endforeach() -else (TARGET Eigen3::Eigen) +else() # otherwise use FindEigen3.cmake module possibly installed somewhere in the path # but make sure EIGEN3_INCLUDE_DIR exists! find_package(Eigen3) @@ -135,21 +135,26 @@ else (TARGET Eigen3::Eigen) 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) + endif() + endif() +endif() 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) + install( + TARGETS libint-Eigen3 + # EXPORT "${pnv}-targets-shared" # LAB must toggle with BUILD_SHARED_LIBS at present + EXPORT "${pnv}-targets-static" + COMPONENT Eigen3 + ) +endif() if (TARGET libint-Eigen3) set(LIBINT_HAS_EIGEN 1) set(LIBINT_HAS_CXX_API 1) -else(TARGET libint-Eigen3) +else() set(LIBINT_HAS_CXX_API 0) -endif(TARGET libint-Eigen3) +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() @@ -157,9 +162,9 @@ endif() # Python is optional, unless ... if (ENABLE_FORTRAN) # ... need fortran find_package(PythonInterp REQUIRED) -else(ENABLE_FORTRAN) +else() find_package(PythonInterp) -endif(ENABLE_FORTRAN) +endif() ################################# Main Project ################################# include(GNUInstallDirs) @@ -271,12 +276,12 @@ 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) + 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) + endif() endif() # Legacy (pre-2.7.0) aliases =========================================================================================== @@ -286,14 +291,14 @@ if (BUILD_SHARED_LIBS) 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) + 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) + endif() endif() # Fortran bindings ===================================================================================================== @@ -312,9 +317,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 @@ -361,7 +366,7 @@ if (ENABLE_FORTRAN) DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) -endif(ENABLE_FORTRAN) +endif() # <<< Install >>> @@ -387,7 +392,7 @@ if (BUILD_SHARED_LIBS) install (TARGETS int-cxx-shared EXPORT "${pnv}-targets-shared" LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif(TARGET int-cxx-shared) + endif() endif() if (BUILD_STATIC_LIBS) @@ -398,7 +403,7 @@ if (BUILD_STATIC_LIBS) install (TARGETS int-cxx-static EXPORT "${pnv}-targets-static" ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif(TARGET int-cxx-static) + endif() endif() # install basis set library From 591599f6c982d338c1ec16ac2f0b03e3258a7576 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 14:13:14 -0500 Subject: [PATCH 005/182] Boost::boost -> Boost::headers upon CMake 3.15 --- CMakeLists.txt | 2 +- cmake/libint2-config.cmake.in | 2 +- src/bin/libint/CMakeLists.txt | 2 +- src/lib/libint/CMakeLists.txt.export | 14 +++++++------- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a4e91c958..32b6c3e74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,7 +260,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() diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index 96b69e89e..e7b9578e5 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -221,7 +221,7 @@ if(NOT TARGET ${NS}::cxx) include(CMakeFindDependencyMacro) if (@LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS@) # Boost headers _not_ unpacked to within `include/libint2/` - if (NOT TARGET Boost::boost) + if (NOT TARGET Boost::headers) find_dependency(Boost 1.57 REQUIRED) endif() endif() diff --git a/src/bin/libint/CMakeLists.txt b/src/bin/libint/CMakeLists.txt index 0915ab27a..9014906a1 100644 --- a/src/bin/libint/CMakeLists.txt +++ b/src/bin/libint/CMakeLists.txt @@ -61,7 +61,7 @@ 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) +target_link_libraries(libint-libcompiler PUBLIC Boost::headers) find_package(MPFR REQUIRED) # only GMPXX is actually required ... target_link_libraries(libint-libcompiler PUBLIC MPFR::GMPXX) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 63d4ef0f7..79e498ddf 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -91,7 +91,7 @@ if (ENABLE_MPFR) endif(ENABLE_MPFR) 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 +if (TARGET Boost::headers) set(LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS 1) else() set(LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS 0) @@ -233,9 +233,9 @@ if (BUILD_SHARED_LIBS) if (REQUIRE_CXX_API) add_library(int-cxx-shared INTERFACE) target_link_libraries (int-cxx-shared INTERFACE int-shared libint-Eigen3) - if (TARGET Boost::boost) - target_link_libraries (int-cxx-shared INTERFACE Boost::boost) - endif(TARGET Boost::boost) + if (TARGET Boost::headers) + target_link_libraries (int-cxx-shared INTERFACE Boost::headers) + endif() target_compile_features(int-cxx-shared INTERFACE "cxx_std_11") target_compile_definitions(int-cxx-shared INTERFACE $ @@ -260,9 +260,9 @@ if (BUILD_STATIC_LIBS) if (REQUIRE_CXX_API) add_library(int-cxx-static INTERFACE) target_link_libraries (int-cxx-static INTERFACE int-static libint-Eigen3) - if (TARGET Boost::boost) - target_link_libraries (int-cxx-static INTERFACE Boost::boost) - endif(TARGET Boost::boost) + if (TARGET Boost::headers) + target_link_libraries (int-cxx-static INTERFACE Boost::headers) + endif() target_compile_features(int-cxx-static INTERFACE "cxx_std_11") target_compile_definitions(int-cxx-static INTERFACE $ From 82541de587c9bac644cb58a86eea0cc26b3ff3db Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 14:14:07 -0500 Subject: [PATCH 006/182] new inbuilt CMake Python detection upon CMake 3.15 --- src/lib/libint/CMakeLists.txt.export | 9 +++++---- src/lib/libint/tests/CMakeLists.txt | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 79e498ddf..5dd8de210 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -161,11 +161,12 @@ endif() # Python is optional, unless ... if (ENABLE_FORTRAN) # ... need fortran - find_package(PythonInterp REQUIRED) + find_package(Python COMPONENTS Interpreter REQUIRED) else() - find_package(PythonInterp) + find_package(Python COMPONENTS Interpreter) endif() + ################################# Main Project ################################# include(GNUInstallDirs) include(CMakePackageConfigHelpers) @@ -334,14 +335,14 @@ 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" ) diff --git a/src/lib/libint/tests/CMakeLists.txt b/src/lib/libint/tests/CMakeLists.txt index 6bfe9604c..067b231e9 100644 --- a/src/lib/libint/tests/CMakeLists.txt +++ b/src/lib/libint/tests/CMakeLists.txt @@ -71,7 +71,7 @@ if (LIBINT_HAS_CXX_API) 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) add_test(NAME libint2/hf/run COMMAND ${CMAKE_COMMAND} -DexecName=hf-libint2 @@ -79,7 +79,7 @@ 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() add_test(NAME libint2/hf/run @@ -96,7 +96,7 @@ if (LIBINT_HAS_CXX_API) 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) add_test(NAME libint2/hf++/run COMMAND ${CMAKE_COMMAND} -DexecName=hf++-libint2 @@ -104,7 +104,7 @@ 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() add_test(NAME libint2/hf++/run From 80ab815df3b5765edc5b36d7fc7bade5ba9cb42f Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 14:14:30 -0500 Subject: [PATCH 007/182] TWOBODY -> ERI --- .github/workflows/cmake.yml | 6 ++--- INSTALL.md | 50 ++++++++++++++++++------------------- cmake/modules/int_am.cmake | 4 +-- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index da09c1e61..2a948c807 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -32,9 +32,9 @@ jobs: -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="2;2" + -DERI_MAX_AM="2;2" + -DERI3_MAX_AM="3;2" -DENABLE_ERI=1 -DENABLE_ERI3=1 -DENABLE_ONEBODY=1 diff --git a/INSTALL.md b/INSTALL.md index f366cb246..321ba2884 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -27,9 +27,9 @@ These are the most useful configure options: ### Which Integrals Classes, Which Derivative Levels * `ENABLE_ONEBODY` -- Compile with support for up to N-th derivatives of 1-body integrals. Use -1 for OFF. [Default=0] -* `ENABLE_TWOBODY4` -- Compile with support for up to N-th derivatives of 4-center electron repulsion integrals. Use -1 for OFF. [Default=0] -* `ENABLE_TWOBODY3` -- Compile with support for up to N-th derivatives of 3-center electron repulsion integrals. Use -1 for OFF. [Default=-1] -* `ENABLE_TWOBODY2` -- Compile with support for up to N-th derivatives of 2-center electron repulsion integrals. Use -1 for OFF. [Default=-1] +* `ENABLE_ERI` -- Compile with support for up to N-th derivatives of 4-center electron repulsion integrals. Use -1 for OFF. [Default=0] +* `ENABLE_ERI3` -- Compile with support for up to N-th derivatives of 3-center electron repulsion integrals. Use -1 for OFF. [Default=-1] +* `ENABLE_ERI2` -- Compile with support for up to N-th derivatives of 2-center electron repulsion integrals. Use -1 for OFF. [Default=-1] * `ENABLE_G12` -- Compile with support for N-th derivatives of MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] * `ENABLE_G12DKH` -- Compile with support for N-th derivatives of DKH-MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] @@ -46,24 +46,24 @@ These are the most useful configure options: * `WITH_ONEBODY_MAX_AM` -- 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` -- 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_TWOBODY4_MAX_AM` -- 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_TWOBODY4_OPT_AM` -- 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_ERI_MAX_AM` -- 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` -- 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_TWOBODY3_MAX_AM` -- 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_TWOBODY3_OPT_AM` -- 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_ERI3_MAX_AM` -- 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` -- 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_TWOBODY2_MAX_AM` -- 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_TWOBODY2_OPT_AM` -- 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_ERI2_MAX_AM` -- 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` -- 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`] ### Autotools Update Guide * `--enable-1body=N` --> `-D ENABLE_ONEBODY` -* `--enable-eri=N` --> `-D ENABLE_ERI=N` --> `-D ENABLE_TWOBODY4=N` -* `--disable-eri` --> `-D ENABLE_ERI=-1` --> `-D ENABLE_TWOBODY4=-1` -* `--enable-eri3=N` --> `-D ENABLE_ERI3=N` --> `-D ENABLE_TWOBODY3=N` -* `--enable-eri2=N` --> `-D ENABLE_ERI2=N` --> `-D ENABLE_TWOBODY2=N` +* `--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-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) @@ -75,20 +75,20 @@ These are the most useful configure options: * `--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` --> `-D WITH_TWOBODY4_MAX_AM=N` -* `--with-eri-max-am=N0,N1,N2` --> `-D WITH_ERI_MAX_AM="N0;N1;N2"` --> `-D WITH_TWOBODY4_MAX_AM="N0;N1;N2"` -* `--with-eri-opt-am=N` --> `-D WITH_ERI_OPT_AM=N` --> `-D WITH_TWOBODY4_OPT_AM=N` -* `--with-eri-opt-am=N0,N1,N2` --> `-D WITH_ERI_OPT_AM="N0;N1;N2"` --> `-D WITH_TWOBODY4_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` --> `-D WITH_TWOBODY3_MAX_AM=N` -* `--with-eri3-max-am=N0,N1,N2` --> `-D WITH_ERI3_MAX_AM="N0;N1;N2"` --> `-D WITH_TWOBODY3_MAX_AM="N0;N1;N2"` -* `--with-eri3-opt-am=N` --> `-D WITH_ERI3_OPT_AM=N` --> `-D WITH_TWOBODY3_OPT_AM=N` -* `--with-eri3-opt-am=N0,N1,N2` --> `-D WITH_ERI3_OPT_AM="N0;N1;N2"` --> `-D WITH_TWOBODY3_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` --> `-D WITH_TWOBODY2_MAX_AM=N` -* `--with-eri2-max-am=N0,N1,N2` --> `-D WITH_ERI2_MAX_AM="N0;N1;N2"` --> `-D WITH_TWOBODY2_MAX_AM="N0;N1;N2"` -* `--with-eri2-opt-am=N` --> `-D WITH_ERI2_OPT_AM=N` --> `-D WITH_TWOBODY2_OPT_AM=N` -* `--with-eri2-opt-am=N0,N1,N2` --> `-D WITH_ERI2_OPT_AM="N0;N1;N2"` --> `-D WITH_TWOBODY2_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-shared` --> `-D BUILD_SHARED_LIBS=ON` (standard CMake variable) * `--enable-static` --> `-D BUILD_SHARED_LIBS=OFF` (standard CMake variable) diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index a9a6182b2..954224cee 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -48,7 +48,7 @@ foreach(_d RANGE 0 ${_max_deriv}) else() set(_candidate0_d${_d} "-1") endif() - message(VERBOSE "setting _candidate0_d${_d}=${_candidate0_d${_d}}") # CMake 3.15 for VERBOSE + message(VERBOSE "setting _candidate0_d${_d}=${_candidate0_d${_d}}") endforeach() if (LIBINT_MAX_AM GREATER_EQUAL 8) @@ -258,5 +258,5 @@ foreach(_cls ERI;ERI3;ERI2) endforeach() endif() endforeach() -message(STATUS "Library will satisfy ERI AM components: ${Libint2_TWOBODY_COMPONENTS}") +message(STATUS "Library will satisfy ERI AM components: ${Libint2_ERI_COMPONENTS}") From af677e5d1882799bd857d85056a60c79b94c3b2e Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 15:06:13 -0500 Subject: [PATCH 008/182] more gha. bump cmake to 3.18 --- .github/workflows/cmake.yml | 6 +++--- CMakeLists.txt | 2 +- src/lib/libint/CMakeLists.txt | 2 +- src/lib/libint/CMakeLists.txt.export | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2a948c807..6b8c6664e 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -33,8 +33,8 @@ jobs: -DENABLE_FORTRAN=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/installed -DWITH_MAX_AM="2;2" - -DERI_MAX_AM="2;2" - -DERI3_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 @@ -123,7 +123,7 @@ jobs: working-directory: ${{github.workspace}}/test_installed_library run: | cat > CMakeLists.txt < Date: Fri, 14 Jan 2022 15:21:26 -0500 Subject: [PATCH 009/182] more gha fix --- .github/workflows/cmake.yml | 2 +- CMakeLists.txt | 1 + cmake/modules/int_am.cmake | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6b8c6664e..8946826e5 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -32,7 +32,7 @@ jobs: -DMPIEXEC_PREFLAGS='--bind-to;none;--allow-run-as-root' -DENABLE_FORTRAN=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/installed - -DWITH_MAX_AM="2;2" + -DWITH_MAX_AM="3;2" -DWITH_ERI_MAX_AM="2;2" -DWITH_ERI3_MAX_AM="3;2" -DENABLE_ERI=1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 9380c5162..4490b2b88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,7 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) include(int_versions) include(options) include(CTest) # defines BUILD_TESTING option +message(STATUS "Building using CMake ${CMAKE_VERSION}") # <<< General >>> diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index 954224cee..0daed1ef3 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -11,6 +11,7 @@ # `find_package(Libint2 COMPONENTS twobody_c4_d1_l5)` +message(STATUS "LAB int.am") message(STATUS "Processing integrals classes ...") # <<< overall derivatives level >>> From c83bf683f7f8a65ba9ee685eda041efddf3e3309 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 16:02:35 -0500 Subject: [PATCH 010/182] weird quotes gha behavior --- .github/workflows/cmake.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 8946826e5..e790fc7d8 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -32,9 +32,9 @@ jobs: -DMPIEXEC_PREFLAGS='--bind-to;none;--allow-run-as-root' -DENABLE_FORTRAN=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/installed - -DWITH_MAX_AM="3;2" - -DWITH_ERI_MAX_AM="2;2" - -DWITH_ERI3_MAX_AM="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 From ed49e125c45d2c3c0a5b7b8d7c3183a25b81daf4 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 23:13:44 -0500 Subject: [PATCH 011/182] gha after fixing features --- cmake/libint2-config.cmake.in | 65 +++++++++++++++++++++++++++++ cmake/modules/int_am.cmake | 10 +++-- cmake/modules/int_computed.cmake.in | 3 +- src/lib/libint/features.in | 2 +- 4 files changed, 75 insertions(+), 5 deletions(-) diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index e7b9578e5..2a4108521 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -95,6 +95,71 @@ set (_valid_components eri_c4_d1_l8 eri_c4_d1_l9 eri_c4_d1_l10 + eri_c4_d2_l2 + eri_c4_d2_l3 + eri_c4_d2_l4 + eri_c4_d2_l5 + eri_c4_d2_l6 + eri_c4_d2_l7 + eri_c4_d2_l8 + eri_c4_d2_l9 + eri_c4_d2_l10 + + eri_c3_d0_l2 + eri_c3_d0_l3 + eri_c3_d0_l4 + eri_c3_d0_l5 + eri_c3_d0_l6 + eri_c3_d0_l7 + eri_c3_d0_l8 + eri_c3_d0_l9 + eri_c3_d0_l10 + eri_c3_d1_l2 + eri_c3_d1_l3 + eri_c3_d1_l4 + eri_c3_d1_l5 + eri_c3_d1_l6 + eri_c3_d1_l7 + eri_c3_d1_l8 + eri_c3_d1_l9 + eri_c3_d1_l10 + eri_c3_d2_l2 + eri_c3_d2_l3 + eri_c3_d2_l4 + eri_c3_d2_l5 + eri_c3_d2_l6 + eri_c3_d2_l7 + eri_c3_d2_l8 + eri_c3_d2_l9 + eri_c3_d2_l10 + + eri_c2_d0_l2 + eri_c2_d0_l3 + eri_c2_d0_l4 + eri_c2_d0_l5 + eri_c2_d0_l6 + eri_c2_d0_l7 + eri_c2_d0_l8 + eri_c2_d0_l9 + eri_c2_d0_l10 + eri_c2_d1_l2 + eri_c2_d1_l3 + eri_c2_d1_l4 + eri_c2_d1_l5 + eri_c2_d1_l6 + eri_c2_d1_l7 + eri_c2_d1_l8 + eri_c2_d1_l9 + eri_c2_d1_l10 + eri_c2_d2_l2 + eri_c2_d2_l3 + eri_c2_d2_l4 + eri_c2_d2_l5 + eri_c2_d2_l6 + eri_c2_d2_l7 + eri_c2_d2_l8 + eri_c2_d2_l9 + eri_c2_d2_l10 ss so diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index 0daed1ef3..8ee71e27c 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -246,9 +246,13 @@ process_integrals_class(G12DKH) # form list of active _ strings to use in Libint2Config set(Libint2_ERI_COMPONENTS "") foreach(_cls ERI;ERI3;ERI2) -# todo use eri4_d0_l2 or eri_c4_d0_l2 - string(TOLOWER ${_cls} _lbl) - #set(_lbl "${_lbl}_") + if (_cls STREQUAL "ERI") + set(_lbl "eri_c4") + elseif (_cls STREQUAL "ERI3") + set(_lbl "eri_c3") + elseif (_cls STREQUAL "ERI2") + set(_lbl "eri_c2") + endif() if (INCLUDE_${_cls} GREATER -1) foreach (_d RANGE 0 ${INCLUDE_${_cls}}) diff --git a/cmake/modules/int_computed.cmake.in b/cmake/modules/int_computed.cmake.in index 00f31387e..c995e3052 100644 --- a/cmake/modules/int_computed.cmake.in +++ b/cmake/modules/int_computed.cmake.in @@ -47,4 +47,5 @@ set(LIBINT2_SHELL_SET "@LIBINT2_SHELL_SET@") # <<< AM Components >>> set(Libint2_ERI_COMPONENTS "@Libint2_ERI_COMPONENTS@") -set(Libint2_MAX_AM_ERI "@_candidate_ERI_E@") +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/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@ From 58eb4e2761f5eede78af65ea8d3f2e7d7f96833a Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Sat, 15 Jan 2022 13:35:31 -0500 Subject: [PATCH 012/182] use std::rand instead of std::random_device to seed RandomShellSet ... this should help with random deviations observed in eri validation --- src/lib/libint/tests/fortran/test-eri.cc | 2 ++ tests/eri/prep_libint2.h | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/libint/tests/fortran/test-eri.cc b/src/lib/libint/tests/fortran/test-eri.cc index a046403e3..2c70c33a4 100644 --- a/src/lib/libint/tests/fortran/test-eri.cc +++ b/src/lib/libint/tests/fortran/test-eri.cc @@ -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/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 From b87123358a3349fbe643135a43d494c0988fbafe Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Sun, 16 Jan 2022 10:50:35 -0500 Subject: [PATCH 013/182] prefactors.cc: pacify gcc --- src/bin/libint/prefactors.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; From 343f2cadd0d360e4d5ff189cfde04d1562c66879 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Sun, 16 Jan 2022 11:00:29 -0500 Subject: [PATCH 014/182] fortran eri test must compare absolute precision, not relative, just like tests/eri/test.cc --- src/lib/libint/tests/fortran/test-eri.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/libint/tests/fortran/test-eri.cc b/src/lib/libint/tests/fortran/test-eri.cc index 2c70c33a4..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 From 656b40a2465715f36defa48cc7fb82c4713da7dc Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Mon, 17 Jan 2022 00:28:37 -0500 Subject: [PATCH 015/182] separate target export files. remove full paths from install config. --- INSTALL.md | 8 +- src/bin/libint/CMakeLists.txt | 4 - src/lib/libint/CMakeLists.txt | 29 +++---- src/lib/libint/CMakeLists.txt.export | 116 +++++++++++++++++---------- 4 files changed, 94 insertions(+), 63 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 321ba2884..0ad2fa8d3 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -59,6 +59,8 @@ These are the most useful configure options: ### Autotools Update Guide +* 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` @@ -90,8 +92,10 @@ These are the most useful configure options: * `--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-shared` --> `-D BUILD_SHARED_LIBS=ON` (standard CMake variable) -* `--enable-static` --> `-D BUILD_SHARED_LIBS=OFF` (standard CMake variable) +* `--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 BUILD_SHARED_LIBS=ON -D LIBINT2_BUILD_SHARED_AND_STATIC_LIBS=ON` +* `-D ENABLE_CXX11API=ON` --> `-D REQUIRE_CXX_API=ON` * Targets * `libint2` --> `Libint2::int2` (internal target name `int-shared`) diff --git a/src/bin/libint/CMakeLists.txt b/src/bin/libint/CMakeLists.txt index 9014906a1..e9ed429f4 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) diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index 30033e53f..23090d50a 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}) @@ -35,20 +32,20 @@ add_custom_command(OUTPUT ${EXPORT_STAGE_DIR}/CMakeLists.txt 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}" 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() # <<< 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) @@ -99,17 +96,17 @@ else(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) 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) + endif() if (CMAKE_PREFIX_PATH) list(APPEND library_CMAKE_ARGS "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ) - 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 @@ -138,7 +135,7 @@ else(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) 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} @@ -146,4 +143,4 @@ else(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) USE_SOURCE_PERMISSIONS OPTIONAL) endforeach() -endif(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) +endif() diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 3c599f037..6bfb8f819 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -35,6 +35,7 @@ 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(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(EXPORT_LOCAL_TARGETS "Install CMake targets with hard-coded dependency paths. Turn OFF when building library for redistribution." ON) if (NOT LIBINT2_REALTYPE) set(LIBINT2_REALTYPE double) @@ -81,10 +82,6 @@ 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) -endif() - # req'd for now (no FindGMP.cmake, though one at Elemental project) if (ENABLE_MPFR) find_package(MPFR REQUIRED) @@ -114,8 +111,8 @@ 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 +# 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) @@ -130,7 +127,7 @@ else() find_package(Eigen3) if (EIGEN3_FOUND) if (NOT EXISTS "${EIGEN3_INCLUDE_DIR}") - message(FATAL_ERROR "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") + 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() add_library(libint-Eigen3 INTERFACE) set_property(TARGET libint-Eigen3 PROPERTY @@ -141,12 +138,6 @@ endif() 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-shared" # LAB must toggle with BUILD_SHARED_LIBS at present - EXPORT "${pnv}-targets-static" - COMPONENT Eigen3 - ) endif() if (TARGET libint-Eigen3) @@ -227,7 +218,7 @@ if (BUILD_SHARED_LIBS) $ $ $ - $) + $) target_compile_features(int-shared INTERFACE "cxx_std_11") # C++ library @@ -238,9 +229,12 @@ if (BUILD_SHARED_LIBS) target_link_libraries (int-cxx-shared INTERFACE Boost::headers) endif() target_compile_features(int-cxx-shared INTERFACE "cxx_std_11") - target_compile_definitions(int-cxx-shared INTERFACE - $ - $) + target_compile_definitions( + int-cxx-shared + INTERFACE + $ + $ + ) set_target_properties (int-cxx-shared PROPERTIES EXPORT_NAME "cxx") endif(REQUIRE_CXX_API) endif() @@ -254,7 +248,7 @@ if (BUILD_STATIC_LIBS) $ $ $ - $) + $) target_compile_features(int-static INTERFACE "cxx_std_11") # C++ library @@ -265,12 +259,15 @@ if (BUILD_STATIC_LIBS) target_link_libraries (int-cxx-static INTERFACE Boost::headers) endif() target_compile_features(int-cxx-static INTERFACE "cxx_std_11") - target_compile_definitions(int-cxx-static INTERFACE - $ - $) + target_compile_definitions( + int-cxx-static + INTERFACE + $ + $ + ) set_target_properties (int-cxx-static PROPERTIES EXPORT_NAME "cxx") - endif(REQUIRE_CXX_API) + endif() endif() if (BUILD_SHARED_LIBS) @@ -355,7 +352,7 @@ if (ENABLE_FORTRAN) $ $ $ - $) + $) target_compile_definitions(libint_f PRIVATE __COMPILING_LIBINT2) set_property(TARGET libint_f PROPERTY Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/fortran/modules) @@ -386,24 +383,45 @@ install(FILES ${PROJECT_SOURCE_DIR}/src/libint2_iface.h #target_include_directories(int-obj PRIVATE ${PROJECT_BINARY_DIR}) if (BUILD_SHARED_LIBS) - install (TARGETS int-shared - EXPORT "${pnv}-targets-shared" - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) if (TARGET int-cxx-shared) - install (TARGETS int-cxx-shared - EXPORT "${pnv}-targets-shared" - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install( + TARGETS int-shared int-cxx-shared + EXPORT shared_set + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + install( + TARGETS int-shared int-cxx-shared libint-Eigen3 + EXPORT local_set + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + else() + install( + TARGETS int-shared + EXPORT shared_set + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) endif() endif() if (BUILD_STATIC_LIBS) - install (TARGETS int-static - EXPORT "${pnv}-targets-static" - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) if (TARGET int-cxx-static) - install (TARGETS int-cxx-static - EXPORT "${pnv}-targets-static" - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install( + TARGETS int-static int-cxx-static + EXPORT static_set + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + install( + TARGETS int-static int-cxx-static libint-Eigen3 + EXPORT local_set + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT Eigen3 + ) + else() + install( + TARGETS int-static + EXPORT static_set + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) endif() endif() @@ -435,13 +453,29 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libint2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/) 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 "${NS}::" + DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + ) 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 "${NS}::" + DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + ) +endif() + +if (EXPORT_LOCAL_TARGETS) + install( + EXPORT local_set + FILE "${pnv}-targets-local.cmake" + NAMESPACE "${NS}::" + DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + ) endif() + From 702a24dffc41a457e98a907866a623b15fc86ba7 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 13 Jan 2022 11:23:56 -0500 Subject: [PATCH 016/182] int_am.cmake work to allow arbitrary deriv, new components format, more validation. start INSTALL.md option documentation. --- CMakeLists.txt | 28 ++-- INSTALL.md | 42 +++++ cmake/modules/int_am.cmake | 265 ++++++++++++++++++------------ cmake/modules/int_orderings.cmake | 6 +- 4 files changed, 217 insertions(+), 124 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86930cfc0..f63a8e108 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,8 @@ include(CTest) # defines BUILD_TESTING option # <<< General >>> +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) @@ -77,7 +79,7 @@ option_with_default(ENABLE_FORTRAN "Build Fortran03+ Libint interface (requires 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 @@ -133,41 +135,41 @@ 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: (libint_max_am/2)+1)" -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" -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) + Can specify values for each derivative level as a semicolon-separated string" -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) + 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 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" -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" -1) option_with_default(WITH_G12_MAX_AM "Support integrals for G12 methods of angular momentum up to N." -1) @@ -302,4 +304,4 @@ endif() # <<< Install >>> -# nothing to install here \ No newline at end of file +# nothing to install here diff --git a/INSTALL.md b/INSTALL.md index 625a8dcfe..b06192b15 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -13,3 +13,45 @@ For (more) complete instructions please refer to https://github.com/evaleev/libi # Appendix + +#################### + + +----------------------------------------------------------------------------- +## configuring libint compiler + +These are the most useful configure options: + + + +### Which Integrals Classes, Which Derivative Levels + +* `ENABLE_ONEBODY` -- Compile with support for up to N-th derivatives of 1-body integrals. Use -1 for OFF. [Default=0] +* `ENABLE_TWOBODY4` -- Compile with support for up to N-th derivatives of 4-center electron repulsion integrals. Use -1 for OFF. [Default=0] +* `ENABLE_TWOBODY3` -- Compile with support for up to N-th derivatives of 3-center electron repulsion integrals. Use -1 for OFF. [Default=-1] +* `ENABLE_TWOBODY2` -- Compile with support for up to N-th derivatives of 2-center electron repulsion integrals. Use -1 for OFF. [Default=-1] +* `ENABLE_G12` -- Compile with support for N-th derivatives of MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] +* `ENABLE_G12DKH` -- Compile with support for N-th derivatives of DKH-MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] + + +### How High Angular Momentum + +# example for "semicolon-separated string": `-DENABLE_ERI3=2 -DWITH_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" + +* `WITH_MAX_AM` -- Support Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. [Default=4] +* `WITH_OPT_AM` -- 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`] + +### Autotools Update Guide + +* `--enable-eri=N` --> `-D ENABLE_ERI=N` --> `ENABLE_TWOBODY4=N` +* `--disable-eri` --> `-D ENABLE_TWOBODY4=-1` +* `--enable-eri3=N` --> `-D ENABLE_ERI3=N` --> `ENABLE_TWOBODY3=N` +* `--enable-eri2=N` --> `-D ENABLE_ERI2=N` --> `ENABLE_TWOBODY2=N` + +* `--with-max-am=N` --> `-D WITH_MAX_AM=N` +* `--with-max-am=N0,N1,N2` --> `-D WITH_MAX_AM="N0;N1;N2"` (notice commas becoming semicolons and quotes; this is normal 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"` + diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index 94a09ae5d..a9a6182b2 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -8,100 +8,135 @@ # 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)` +# `find_package(Libint2 COMPONENTS twobody_c4_d1_l5)` 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}) +list(SORT _glob_classes_derivs COMPARE NATURAL ORDER DESCENDING) # CMake 3.18 for NATURAL +list(GET _glob_classes_derivs 0 _max_deriv) +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() + + set(_sorted_WITH_MAX_AM ${WITH_MAX_AM}) + list(SORT _sorted_WITH_MAX_AM COMPARE NATURAL ORDER DESCENDING) + list(GET _sorted_WITH_MAX_AM 0 _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}}") # CMake 3.15 for VERBOSE +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) + list(SORT _processed_OPT_AM_LIST COMPARE NATURAL ORDER DESCENDING) + list(GET _processed_OPT_AM_LIST 0 LIBINT_OPT_AM) 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) + list(SORT _processed_OPT_AM_LIST COMPARE NATURAL ORDER DESCENDING) + list(GET _processed_OPT_AM_LIST 0 LIBINT_OPT_AM) + 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 +150,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,22 +221,22 @@ macro(process_integrals_class class) set(${class}_OPT_AM "") else() set(${class}_OPT_AM ${WITH_${class}_OPT_AM}) - - if (${class}_OPT_AM GREATER _max_${class}_MAX_AM) - message(FATAL "Invalid value for ${class}_OPT_AM (${${class}_OPT_AM} !<= ${_max_${class}_MAX_AM}).") - endif() 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})") + 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() process_integrals_class(ONEBODY) -process_integrals_class(ERI2) -process_integrals_class(ERI3) process_integrals_class(ERI) +process_integrals_class(ERI3) +process_integrals_class(ERI2) # discrepancy, as configure doesn't do AM_LIST for these process_integrals_class(G12) @@ -199,15 +244,19 @@ process_integrals_class(G12DKH) # form list of active _ strings to use in Libint2Config set(Libint2_ERI_COMPONENTS "") -foreach(_cls ERI2;ERI3;ERI4) +foreach(_cls ERI;ERI3;ERI2) +# todo use eri4_d0_l2 or eri_c4_d0_l2 string(TOLOWER ${_cls} _lbl) - set(_lbl "${_lbl}_") + #set(_lbl "${_lbl}_") - 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}") +message(STATUS "Library will satisfy ERI AM components: ${Libint2_TWOBODY_COMPONENTS}") 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() From f0624df6f317ec73a778fe62cf77ccf118fd1df4 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 13 Jan 2022 14:34:28 -0500 Subject: [PATCH 017/182] standardize copyright date for new files --- LICENSE | 2 +- include/libint2/config.h.cmake.in | 2 +- include/libint2/config2.h.cmake.in | 2 +- src/lib/libint/LICENSE.export | 2 +- src/lib/libint/tests/eri/test.cc | 2 +- src/lib/libint/tests/fortran/test.cc | 2 +- src/lib/libint/tests/hartree-fock/hartree-fock++.cc | 2 +- src/lib/libint/tests/hartree-fock/hartree-fock.cc | 2 +- src/lib/libint/tests/unit/test.cc | 2 +- tests/eri/test.cc | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) 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/include/libint2/config.h.cmake.in b/include/libint2/config.h.cmake.in index acd00885c..95400f313 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. * 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/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/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.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.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/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. * From a3c502b38daef0e818708e555b7e301811c7799f Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 02:42:24 -0500 Subject: [PATCH 018/182] misc. fixes --- CMakeLists.txt | 3 ++ INSTALL.md | 53 +++++++++++++++++++++++++--- src/bin/libint/CMakeLists.txt | 2 +- src/lib/libint/CMakeLists.txt.export | 10 +++--- src/lib/libint/tests/CMakeLists.txt | 2 +- 5 files changed, 59 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f63a8e108..048dbed1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,9 @@ option_with_default(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT "[EXPERT] Build generated 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(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 diff --git a/INSTALL.md b/INSTALL.md index b06192b15..f366cb246 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -43,15 +43,58 @@ These are the most useful configure options: * `WITH_MAX_AM` -- Support Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. [Default=4] * `WITH_OPT_AM` -- 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`] +* `WITH_ONEBODY_MAX_AM` -- 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` -- 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_TWOBODY4_MAX_AM` -- 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_TWOBODY4_OPT_AM` -- 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_TWOBODY3_MAX_AM` -- 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_TWOBODY3_OPT_AM` -- 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_TWOBODY2_MAX_AM` -- 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_TWOBODY2_OPT_AM` -- 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`] + + + ### Autotools Update Guide -* `--enable-eri=N` --> `-D ENABLE_ERI=N` --> `ENABLE_TWOBODY4=N` -* `--disable-eri` --> `-D ENABLE_TWOBODY4=-1` -* `--enable-eri3=N` --> `-D ENABLE_ERI3=N` --> `ENABLE_TWOBODY3=N` -* `--enable-eri2=N` --> `-D ENABLE_ERI2=N` --> `ENABLE_TWOBODY2=N` +* `--enable-1body=N` --> `-D ENABLE_ONEBODY` +* `--enable-eri=N` --> `-D ENABLE_ERI=N` --> `-D ENABLE_TWOBODY4=N` +* `--disable-eri` --> `-D ENABLE_ERI=-1` --> `-D ENABLE_TWOBODY4=-1` +* `--enable-eri3=N` --> `-D ENABLE_ERI3=N` --> `-D ENABLE_TWOBODY3=N` +* `--enable-eri2=N` --> `-D ENABLE_ERI2=N` --> `-D ENABLE_TWOBODY2=N` * `--with-max-am=N` --> `-D WITH_MAX_AM=N` -* `--with-max-am=N0,N1,N2` --> `-D WITH_MAX_AM="N0;N1;N2"` (notice commas becoming semicolons and quotes; this is normal CMake list syntax) +* `--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-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` --> `-D WITH_TWOBODY4_MAX_AM=N` +* `--with-eri-max-am=N0,N1,N2` --> `-D WITH_ERI_MAX_AM="N0;N1;N2"` --> `-D WITH_TWOBODY4_MAX_AM="N0;N1;N2"` +* `--with-eri-opt-am=N` --> `-D WITH_ERI_OPT_AM=N` --> `-D WITH_TWOBODY4_OPT_AM=N` +* `--with-eri-opt-am=N0,N1,N2` --> `-D WITH_ERI_OPT_AM="N0;N1;N2"` --> `-D WITH_TWOBODY4_OPT_AM="N0;N1;N2"` + +* `--with-eri3-max-am=N` --> `-D WITH_ERI3_MAX_AM=N` --> `-D WITH_TWOBODY3_MAX_AM=N` +* `--with-eri3-max-am=N0,N1,N2` --> `-D WITH_ERI3_MAX_AM="N0;N1;N2"` --> `-D WITH_TWOBODY3_MAX_AM="N0;N1;N2"` +* `--with-eri3-opt-am=N` --> `-D WITH_ERI3_OPT_AM=N` --> `-D WITH_TWOBODY3_OPT_AM=N` +* `--with-eri3-opt-am=N0,N1,N2` --> `-D WITH_ERI3_OPT_AM="N0;N1;N2"` --> `-D WITH_TWOBODY3_OPT_AM="N0;N1;N2"` + +* `--with-eri2-max-am=N` --> `-D WITH_ERI2_MAX_AM=N` --> `-D WITH_TWOBODY2_MAX_AM=N` +* `--with-eri2-max-am=N0,N1,N2` --> `-D WITH_ERI2_MAX_AM="N0;N1;N2"` --> `-D WITH_TWOBODY2_MAX_AM="N0;N1;N2"` +* `--with-eri2-opt-am=N` --> `-D WITH_ERI2_OPT_AM=N` --> `-D WITH_TWOBODY2_OPT_AM=N` +* `--with-eri2-opt-am=N0,N1,N2` --> `-D WITH_ERI2_OPT_AM="N0;N1;N2"` --> `-D WITH_TWOBODY2_OPT_AM="N0;N1;N2"` + +* `--enable-shared` --> `-D BUILD_SHARED_LIBS=ON` (standard CMake variable) +* `--enable-static` --> `-D BUILD_SHARED_LIBS=OFF` (standard CMake variable) + +* Targets + * `libint2` --> `Libint2::int2` (internal target name `int-shared`) + * `libint2_cxx` --> `Libint2::cxx` (internal target name `int-cxx-shared`) + + diff --git a/src/bin/libint/CMakeLists.txt b/src/bin/libint/CMakeLists.txt index f34421ac7..0915ab27a 100644 --- a/src/bin/libint/CMakeLists.txt +++ b/src/bin/libint/CMakeLists.txt @@ -13,7 +13,7 @@ endif() ### compiler library -add_library(libint-libcompiler +add_library(libint-libcompiler STATIC algebra.cc buildtest.cc class_registry.cc diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 67c95af88..6ce458edb 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -30,10 +30,12 @@ include(int_computed) 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(ENABLE_FORTRAN "Build Fortran03+ Libint interface (requires C and Fortran and Python)" 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) +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) + if (NOT LIBINT2_REALTYPE) set(LIBINT2_REALTYPE double) endif() @@ -128,8 +130,8 @@ else (TARGET Eigen3::Eigen) 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}") + message(FATAL_ERROR "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() add_library(libint-Eigen3 INTERFACE) set_property(TARGET libint-Eigen3 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIR}) diff --git a/src/lib/libint/tests/CMakeLists.txt b/src/lib/libint/tests/CMakeLists.txt index c1622ee15..6bfe9604c 100644 --- a/src/lib/libint/tests/CMakeLists.txt +++ b/src/lib/libint/tests/CMakeLists.txt @@ -83,7 +83,7 @@ if (LIBINT_HAS_CXX_API) -P ${PROJECT_SOURCE_DIR}/tests/hartree-fock/hftest.cmake) else() 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) From 299f396c78886dfdc9bc230497f715bc8edea9bf Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 12:55:28 -0500 Subject: [PATCH 019/182] fill out options descriptions. simpler cmake if/else/endif syntax. --- CMakeLists.txt | 26 +++++++++--------- src/lib/libint/CMakeLists.txt.export | 41 ++++++++++++++++------------ 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 048dbed1a..a4e91c958 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,42 +147,42 @@ 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 level 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 level 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 level 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). + "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 level 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 level 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 level 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 level 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 >>> diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 6ce458edb..7dfddb32b 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -46,7 +46,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() @@ -124,7 +124,7 @@ if (TARGET Eigen3::Eigen) set_property(TARGET libint-Eigen3 PROPERTY ${prop} ${EIGEN3_${prop}}) endforeach() -else (TARGET Eigen3::Eigen) +else() # otherwise use FindEigen3.cmake module possibly installed somewhere in the path # but make sure EIGEN3_INCLUDE_DIR exists! find_package(Eigen3) @@ -135,21 +135,26 @@ else (TARGET Eigen3::Eigen) 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) + endif() + endif() +endif() 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) + install( + TARGETS libint-Eigen3 + # EXPORT "${pnv}-targets-shared" # LAB must toggle with BUILD_SHARED_LIBS at present + EXPORT "${pnv}-targets-static" + COMPONENT Eigen3 + ) +endif() if (TARGET libint-Eigen3) set(LIBINT_HAS_EIGEN 1) set(LIBINT_HAS_CXX_API 1) -else(TARGET libint-Eigen3) +else() set(LIBINT_HAS_CXX_API 0) -endif(TARGET libint-Eigen3) +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() @@ -157,9 +162,9 @@ endif() # Python is optional, unless ... if (ENABLE_FORTRAN) # ... need fortran find_package(PythonInterp REQUIRED) -else(ENABLE_FORTRAN) +else() find_package(PythonInterp) -endif(ENABLE_FORTRAN) +endif() ################################# Main Project ################################# include(GNUInstallDirs) @@ -303,12 +308,12 @@ 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) + 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) + endif() endif() # Legacy (pre-2.7.0) aliases =========================================================================================== @@ -318,14 +323,14 @@ if (BUILD_SHARED_LIBS) 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) + 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) + endif() endif() # Fortran bindings ===================================================================================================== @@ -344,9 +349,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 @@ -393,7 +398,7 @@ if (ENABLE_FORTRAN) DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) -endif(ENABLE_FORTRAN) +endif() # <<< Install >>> From 81645859a8fcfa0b0ffcf23037df082a06b261f7 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 14:13:14 -0500 Subject: [PATCH 020/182] Boost::boost -> Boost::headers upon CMake 3.15 --- CMakeLists.txt | 2 +- cmake/libint2-config.cmake.in | 2 +- src/bin/libint/CMakeLists.txt | 2 +- src/lib/libint/CMakeLists.txt.export | 14 +++++++------- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a4e91c958..32b6c3e74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,7 +260,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() diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index 96b69e89e..e7b9578e5 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -221,7 +221,7 @@ if(NOT TARGET ${NS}::cxx) include(CMakeFindDependencyMacro) if (@LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS@) # Boost headers _not_ unpacked to within `include/libint2/` - if (NOT TARGET Boost::boost) + if (NOT TARGET Boost::headers) find_dependency(Boost 1.57 REQUIRED) endif() endif() diff --git a/src/bin/libint/CMakeLists.txt b/src/bin/libint/CMakeLists.txt index 0915ab27a..9014906a1 100644 --- a/src/bin/libint/CMakeLists.txt +++ b/src/bin/libint/CMakeLists.txt @@ -61,7 +61,7 @@ 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) +target_link_libraries(libint-libcompiler PUBLIC Boost::headers) find_package(MPFR REQUIRED) # only GMPXX is actually required ... target_link_libraries(libint-libcompiler PUBLIC MPFR::GMPXX) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 7dfddb32b..8bb2388d5 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -91,7 +91,7 @@ if (ENABLE_MPFR) endif(ENABLE_MPFR) 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 +if (TARGET Boost::headers) set(LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS 1) else() set(LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS 0) @@ -252,9 +252,9 @@ if (BUILD_SHARED_LIBS) 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) + if (TARGET Boost::headers) + target_link_libraries (int-cxx-headeronly-shared INTERFACE Boost::headers) + endif() target_compile_features(int-cxx-headeronly-shared INTERFACE "cxx_std_11") target_compile_definitions(int-cxx-headeronly-shared INTERFACE $ @@ -287,9 +287,9 @@ if (BUILD_STATIC_LIBS) 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) + if (TARGET Boost::headers) + target_link_libraries (int-cxx-headeronly-static INTERFACE Boost::headers) + endif() target_compile_features(int-cxx-headeronly-static INTERFACE "cxx_std_11") target_compile_definitions(int-cxx-headeronly-static INTERFACE $ From b4643943d0c7e7737903985b1cd62c2255d44b6d Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 14:14:07 -0500 Subject: [PATCH 021/182] new inbuilt CMake Python detection upon CMake 3.15 --- src/lib/libint/CMakeLists.txt.export | 9 +++++---- src/lib/libint/tests/CMakeLists.txt | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 8bb2388d5..234d1b986 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -161,11 +161,12 @@ endif() # Python is optional, unless ... if (ENABLE_FORTRAN) # ... need fortran - find_package(PythonInterp REQUIRED) + find_package(Python COMPONENTS Interpreter REQUIRED) else() - find_package(PythonInterp) + find_package(Python COMPONENTS Interpreter) endif() + ################################# Main Project ################################# include(GNUInstallDirs) include(CMakePackageConfigHelpers) @@ -366,14 +367,14 @@ 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" ) diff --git a/src/lib/libint/tests/CMakeLists.txt b/src/lib/libint/tests/CMakeLists.txt index 6bfe9604c..067b231e9 100644 --- a/src/lib/libint/tests/CMakeLists.txt +++ b/src/lib/libint/tests/CMakeLists.txt @@ -71,7 +71,7 @@ if (LIBINT_HAS_CXX_API) 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) add_test(NAME libint2/hf/run COMMAND ${CMAKE_COMMAND} -DexecName=hf-libint2 @@ -79,7 +79,7 @@ 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() add_test(NAME libint2/hf/run @@ -96,7 +96,7 @@ if (LIBINT_HAS_CXX_API) 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) add_test(NAME libint2/hf++/run COMMAND ${CMAKE_COMMAND} -DexecName=hf++-libint2 @@ -104,7 +104,7 @@ 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() add_test(NAME libint2/hf++/run From 17dc02e4f3da79ee9ec0da7e6dbd010ac3ce2a42 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 14:14:30 -0500 Subject: [PATCH 022/182] TWOBODY -> ERI --- .github/workflows/cmake.yml | 6 ++--- INSTALL.md | 50 ++++++++++++++++++------------------- cmake/modules/int_am.cmake | 4 +-- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index da09c1e61..2a948c807 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -32,9 +32,9 @@ jobs: -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="2;2" + -DERI_MAX_AM="2;2" + -DERI3_MAX_AM="3;2" -DENABLE_ERI=1 -DENABLE_ERI3=1 -DENABLE_ONEBODY=1 diff --git a/INSTALL.md b/INSTALL.md index f366cb246..321ba2884 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -27,9 +27,9 @@ These are the most useful configure options: ### Which Integrals Classes, Which Derivative Levels * `ENABLE_ONEBODY` -- Compile with support for up to N-th derivatives of 1-body integrals. Use -1 for OFF. [Default=0] -* `ENABLE_TWOBODY4` -- Compile with support for up to N-th derivatives of 4-center electron repulsion integrals. Use -1 for OFF. [Default=0] -* `ENABLE_TWOBODY3` -- Compile with support for up to N-th derivatives of 3-center electron repulsion integrals. Use -1 for OFF. [Default=-1] -* `ENABLE_TWOBODY2` -- Compile with support for up to N-th derivatives of 2-center electron repulsion integrals. Use -1 for OFF. [Default=-1] +* `ENABLE_ERI` -- Compile with support for up to N-th derivatives of 4-center electron repulsion integrals. Use -1 for OFF. [Default=0] +* `ENABLE_ERI3` -- Compile with support for up to N-th derivatives of 3-center electron repulsion integrals. Use -1 for OFF. [Default=-1] +* `ENABLE_ERI2` -- Compile with support for up to N-th derivatives of 2-center electron repulsion integrals. Use -1 for OFF. [Default=-1] * `ENABLE_G12` -- Compile with support for N-th derivatives of MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] * `ENABLE_G12DKH` -- Compile with support for N-th derivatives of DKH-MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] @@ -46,24 +46,24 @@ These are the most useful configure options: * `WITH_ONEBODY_MAX_AM` -- 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` -- 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_TWOBODY4_MAX_AM` -- 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_TWOBODY4_OPT_AM` -- 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_ERI_MAX_AM` -- 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` -- 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_TWOBODY3_MAX_AM` -- 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_TWOBODY3_OPT_AM` -- 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_ERI3_MAX_AM` -- 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` -- 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_TWOBODY2_MAX_AM` -- 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_TWOBODY2_OPT_AM` -- 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_ERI2_MAX_AM` -- 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` -- 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`] ### Autotools Update Guide * `--enable-1body=N` --> `-D ENABLE_ONEBODY` -* `--enable-eri=N` --> `-D ENABLE_ERI=N` --> `-D ENABLE_TWOBODY4=N` -* `--disable-eri` --> `-D ENABLE_ERI=-1` --> `-D ENABLE_TWOBODY4=-1` -* `--enable-eri3=N` --> `-D ENABLE_ERI3=N` --> `-D ENABLE_TWOBODY3=N` -* `--enable-eri2=N` --> `-D ENABLE_ERI2=N` --> `-D ENABLE_TWOBODY2=N` +* `--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-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) @@ -75,20 +75,20 @@ These are the most useful configure options: * `--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` --> `-D WITH_TWOBODY4_MAX_AM=N` -* `--with-eri-max-am=N0,N1,N2` --> `-D WITH_ERI_MAX_AM="N0;N1;N2"` --> `-D WITH_TWOBODY4_MAX_AM="N0;N1;N2"` -* `--with-eri-opt-am=N` --> `-D WITH_ERI_OPT_AM=N` --> `-D WITH_TWOBODY4_OPT_AM=N` -* `--with-eri-opt-am=N0,N1,N2` --> `-D WITH_ERI_OPT_AM="N0;N1;N2"` --> `-D WITH_TWOBODY4_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` --> `-D WITH_TWOBODY3_MAX_AM=N` -* `--with-eri3-max-am=N0,N1,N2` --> `-D WITH_ERI3_MAX_AM="N0;N1;N2"` --> `-D WITH_TWOBODY3_MAX_AM="N0;N1;N2"` -* `--with-eri3-opt-am=N` --> `-D WITH_ERI3_OPT_AM=N` --> `-D WITH_TWOBODY3_OPT_AM=N` -* `--with-eri3-opt-am=N0,N1,N2` --> `-D WITH_ERI3_OPT_AM="N0;N1;N2"` --> `-D WITH_TWOBODY3_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` --> `-D WITH_TWOBODY2_MAX_AM=N` -* `--with-eri2-max-am=N0,N1,N2` --> `-D WITH_ERI2_MAX_AM="N0;N1;N2"` --> `-D WITH_TWOBODY2_MAX_AM="N0;N1;N2"` -* `--with-eri2-opt-am=N` --> `-D WITH_ERI2_OPT_AM=N` --> `-D WITH_TWOBODY2_OPT_AM=N` -* `--with-eri2-opt-am=N0,N1,N2` --> `-D WITH_ERI2_OPT_AM="N0;N1;N2"` --> `-D WITH_TWOBODY2_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-shared` --> `-D BUILD_SHARED_LIBS=ON` (standard CMake variable) * `--enable-static` --> `-D BUILD_SHARED_LIBS=OFF` (standard CMake variable) diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index a9a6182b2..954224cee 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -48,7 +48,7 @@ foreach(_d RANGE 0 ${_max_deriv}) else() set(_candidate0_d${_d} "-1") endif() - message(VERBOSE "setting _candidate0_d${_d}=${_candidate0_d${_d}}") # CMake 3.15 for VERBOSE + message(VERBOSE "setting _candidate0_d${_d}=${_candidate0_d${_d}}") endforeach() if (LIBINT_MAX_AM GREATER_EQUAL 8) @@ -258,5 +258,5 @@ foreach(_cls ERI;ERI3;ERI2) endforeach() endif() endforeach() -message(STATUS "Library will satisfy ERI AM components: ${Libint2_TWOBODY_COMPONENTS}") +message(STATUS "Library will satisfy ERI AM components: ${Libint2_ERI_COMPONENTS}") From eac771cb9056980fb973fb120e4dffb5b1033682 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 15:06:13 -0500 Subject: [PATCH 023/182] more gha. bump cmake to 3.18 --- .github/workflows/cmake.yml | 6 +++--- CMakeLists.txt | 2 +- src/lib/libint/CMakeLists.txt | 2 +- src/lib/libint/CMakeLists.txt.export | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2a948c807..6b8c6664e 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -33,8 +33,8 @@ jobs: -DENABLE_FORTRAN=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/installed -DWITH_MAX_AM="2;2" - -DERI_MAX_AM="2;2" - -DERI3_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 @@ -123,7 +123,7 @@ jobs: working-directory: ${{github.workspace}}/test_installed_library run: | cat > CMakeLists.txt < Date: Fri, 14 Jan 2022 15:21:26 -0500 Subject: [PATCH 024/182] more gha fix --- .github/workflows/cmake.yml | 2 +- CMakeLists.txt | 1 + cmake/modules/int_am.cmake | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6b8c6664e..8946826e5 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -32,7 +32,7 @@ jobs: -DMPIEXEC_PREFLAGS='--bind-to;none;--allow-run-as-root' -DENABLE_FORTRAN=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/installed - -DWITH_MAX_AM="2;2" + -DWITH_MAX_AM="3;2" -DWITH_ERI_MAX_AM="2;2" -DWITH_ERI3_MAX_AM="3;2" -DENABLE_ERI=1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 9380c5162..4490b2b88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,7 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) include(int_versions) include(options) include(CTest) # defines BUILD_TESTING option +message(STATUS "Building using CMake ${CMAKE_VERSION}") # <<< General >>> diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index 954224cee..0daed1ef3 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -11,6 +11,7 @@ # `find_package(Libint2 COMPONENTS twobody_c4_d1_l5)` +message(STATUS "LAB int.am") message(STATUS "Processing integrals classes ...") # <<< overall derivatives level >>> From bdf8ab47d754ba9bcb04f56a85d6285dfd677ea4 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 16:02:35 -0500 Subject: [PATCH 025/182] weird quotes gha behavior --- .github/workflows/cmake.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 8946826e5..e790fc7d8 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -32,9 +32,9 @@ jobs: -DMPIEXEC_PREFLAGS='--bind-to;none;--allow-run-as-root' -DENABLE_FORTRAN=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/installed - -DWITH_MAX_AM="3;2" - -DWITH_ERI_MAX_AM="2;2" - -DWITH_ERI3_MAX_AM="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 From 560c71b1e900f671c906b4e674a3be3373709858 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 14 Jan 2022 23:13:44 -0500 Subject: [PATCH 026/182] gha after fixing features --- cmake/libint2-config.cmake.in | 65 +++++++++++++++++++++++++++++ cmake/modules/int_am.cmake | 10 +++-- cmake/modules/int_computed.cmake.in | 3 +- src/lib/libint/features.in | 2 +- 4 files changed, 75 insertions(+), 5 deletions(-) diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index e7b9578e5..2a4108521 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -95,6 +95,71 @@ set (_valid_components eri_c4_d1_l8 eri_c4_d1_l9 eri_c4_d1_l10 + eri_c4_d2_l2 + eri_c4_d2_l3 + eri_c4_d2_l4 + eri_c4_d2_l5 + eri_c4_d2_l6 + eri_c4_d2_l7 + eri_c4_d2_l8 + eri_c4_d2_l9 + eri_c4_d2_l10 + + eri_c3_d0_l2 + eri_c3_d0_l3 + eri_c3_d0_l4 + eri_c3_d0_l5 + eri_c3_d0_l6 + eri_c3_d0_l7 + eri_c3_d0_l8 + eri_c3_d0_l9 + eri_c3_d0_l10 + eri_c3_d1_l2 + eri_c3_d1_l3 + eri_c3_d1_l4 + eri_c3_d1_l5 + eri_c3_d1_l6 + eri_c3_d1_l7 + eri_c3_d1_l8 + eri_c3_d1_l9 + eri_c3_d1_l10 + eri_c3_d2_l2 + eri_c3_d2_l3 + eri_c3_d2_l4 + eri_c3_d2_l5 + eri_c3_d2_l6 + eri_c3_d2_l7 + eri_c3_d2_l8 + eri_c3_d2_l9 + eri_c3_d2_l10 + + eri_c2_d0_l2 + eri_c2_d0_l3 + eri_c2_d0_l4 + eri_c2_d0_l5 + eri_c2_d0_l6 + eri_c2_d0_l7 + eri_c2_d0_l8 + eri_c2_d0_l9 + eri_c2_d0_l10 + eri_c2_d1_l2 + eri_c2_d1_l3 + eri_c2_d1_l4 + eri_c2_d1_l5 + eri_c2_d1_l6 + eri_c2_d1_l7 + eri_c2_d1_l8 + eri_c2_d1_l9 + eri_c2_d1_l10 + eri_c2_d2_l2 + eri_c2_d2_l3 + eri_c2_d2_l4 + eri_c2_d2_l5 + eri_c2_d2_l6 + eri_c2_d2_l7 + eri_c2_d2_l8 + eri_c2_d2_l9 + eri_c2_d2_l10 ss so diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index 0daed1ef3..8ee71e27c 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -246,9 +246,13 @@ process_integrals_class(G12DKH) # form list of active _ strings to use in Libint2Config set(Libint2_ERI_COMPONENTS "") foreach(_cls ERI;ERI3;ERI2) -# todo use eri4_d0_l2 or eri_c4_d0_l2 - string(TOLOWER ${_cls} _lbl) - #set(_lbl "${_lbl}_") + if (_cls STREQUAL "ERI") + set(_lbl "eri_c4") + elseif (_cls STREQUAL "ERI3") + set(_lbl "eri_c3") + elseif (_cls STREQUAL "ERI2") + set(_lbl "eri_c2") + endif() if (INCLUDE_${_cls} GREATER -1) foreach (_d RANGE 0 ${INCLUDE_${_cls}}) diff --git a/cmake/modules/int_computed.cmake.in b/cmake/modules/int_computed.cmake.in index 00f31387e..c995e3052 100644 --- a/cmake/modules/int_computed.cmake.in +++ b/cmake/modules/int_computed.cmake.in @@ -47,4 +47,5 @@ set(LIBINT2_SHELL_SET "@LIBINT2_SHELL_SET@") # <<< AM Components >>> set(Libint2_ERI_COMPONENTS "@Libint2_ERI_COMPONENTS@") -set(Libint2_MAX_AM_ERI "@_candidate_ERI_E@") +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/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@ From 864022b83e0fbe1809bf868e4426947fabd72753 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Sat, 15 Jan 2022 13:35:31 -0500 Subject: [PATCH 027/182] use std::rand instead of std::random_device to seed RandomShellSet ... this should help with random deviations observed in eri validation --- src/lib/libint/tests/fortran/test-eri.cc | 2 ++ tests/eri/prep_libint2.h | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/libint/tests/fortran/test-eri.cc b/src/lib/libint/tests/fortran/test-eri.cc index a046403e3..2c70c33a4 100644 --- a/src/lib/libint/tests/fortran/test-eri.cc +++ b/src/lib/libint/tests/fortran/test-eri.cc @@ -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/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 From c85c416d6b078aedc722f658e590116115a517c0 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Sun, 16 Jan 2022 10:50:35 -0500 Subject: [PATCH 028/182] prefactors.cc: pacify gcc --- src/bin/libint/prefactors.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; From ac5ee1a5e04bb85ce627307e26319289f263fca4 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Sun, 16 Jan 2022 11:00:29 -0500 Subject: [PATCH 029/182] fortran eri test must compare absolute precision, not relative, just like tests/eri/test.cc --- src/lib/libint/tests/fortran/test-eri.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/libint/tests/fortran/test-eri.cc b/src/lib/libint/tests/fortran/test-eri.cc index 2c70c33a4..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 From ba2151995b4f665604ae84e0765acae0560b90a1 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Mon, 17 Jan 2022 00:28:37 -0500 Subject: [PATCH 030/182] separate target export files. remove full paths from install config. --- INSTALL.md | 8 +- src/bin/libint/CMakeLists.txt | 4 - src/lib/libint/CMakeLists.txt | 29 +++---- src/lib/libint/CMakeLists.txt.export | 114 +++++++++++++++++---------- 4 files changed, 93 insertions(+), 62 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 321ba2884..0ad2fa8d3 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -59,6 +59,8 @@ These are the most useful configure options: ### Autotools Update Guide +* 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` @@ -90,8 +92,10 @@ These are the most useful configure options: * `--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-shared` --> `-D BUILD_SHARED_LIBS=ON` (standard CMake variable) -* `--enable-static` --> `-D BUILD_SHARED_LIBS=OFF` (standard CMake variable) +* `--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 BUILD_SHARED_LIBS=ON -D LIBINT2_BUILD_SHARED_AND_STATIC_LIBS=ON` +* `-D ENABLE_CXX11API=ON` --> `-D REQUIRE_CXX_API=ON` * Targets * `libint2` --> `Libint2::int2` (internal target name `int-shared`) diff --git a/src/bin/libint/CMakeLists.txt b/src/bin/libint/CMakeLists.txt index 9014906a1..e9ed429f4 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) diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index 30033e53f..23090d50a 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}) @@ -35,20 +32,20 @@ add_custom_command(OUTPUT ${EXPORT_STAGE_DIR}/CMakeLists.txt 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}" 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() # <<< 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) @@ -99,17 +96,17 @@ else(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) 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) + endif() if (CMAKE_PREFIX_PATH) list(APPEND library_CMAKE_ARGS "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ) - 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 @@ -138,7 +135,7 @@ else(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) 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} @@ -146,4 +143,4 @@ else(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) USE_SOURCE_PERMISSIONS OPTIONAL) endforeach() -endif(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) +endif() diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index e81b95253..fe7395548 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -35,6 +35,7 @@ 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(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(EXPORT_LOCAL_TARGETS "Install CMake targets with hard-coded dependency paths. Turn OFF when building library for redistribution." ON) if (NOT LIBINT2_REALTYPE) set(LIBINT2_REALTYPE double) @@ -81,10 +82,6 @@ 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) -endif() - # req'd for now (no FindGMP.cmake, though one at Elemental project) if (ENABLE_MPFR) find_package(MPFR REQUIRED) @@ -114,8 +111,8 @@ 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 +# 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) @@ -130,7 +127,7 @@ else() find_package(Eigen3) if (EIGEN3_FOUND) if (NOT EXISTS "${EIGEN3_INCLUDE_DIR}") - message(FATAL_ERROR "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") + 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() add_library(libint-Eigen3 INTERFACE) set_property(TARGET libint-Eigen3 PROPERTY @@ -141,12 +138,6 @@ endif() 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-shared" # LAB must toggle with BUILD_SHARED_LIBS at present - EXPORT "${pnv}-targets-static" - COMPONENT Eigen3 - ) endif() if (TARGET libint-Eigen3) @@ -246,7 +237,7 @@ if (BUILD_SHARED_LIBS) $ $ $ - $) + $) target_compile_features(int-shared INTERFACE "cxx_std_11") # C++ library @@ -257,9 +248,12 @@ if (BUILD_SHARED_LIBS) target_link_libraries (int-cxx-headeronly-shared INTERFACE Boost::headers) endif() target_compile_features(int-cxx-headeronly-shared INTERFACE "cxx_std_11") - target_compile_definitions(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 @@ -281,7 +275,7 @@ if (BUILD_STATIC_LIBS) $ $ $ - $) + $) target_compile_features(int-static INTERFACE "cxx_std_11") # C++ library @@ -292,9 +286,12 @@ if (BUILD_STATIC_LIBS) target_link_libraries (int-cxx-headeronly-static INTERFACE Boost::headers) endif() target_compile_features(int-cxx-headeronly-static INTERFACE "cxx_std_11") - target_compile_definitions(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 @@ -387,7 +384,7 @@ if (ENABLE_FORTRAN) $ $ $ - $) + $) target_compile_definitions(libint_f PRIVATE __COMPILING_LIBINT2) set_property(TARGET libint_f PROPERTY Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/fortran/modules) @@ -418,24 +415,45 @@ install(FILES ${PROJECT_SOURCE_DIR}/src/libint2_iface.h #target_include_directories(int-obj PRIVATE ${PROJECT_BINARY_DIR}) 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}) + install( + TARGETS int-shared int-cxx-shared int-cxx-headeronly-shared + EXPORT shared_set + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + install( + TARGETS int-shared int-cxx-shared int-cxx-headeronly-shared libint-Eigen3 + EXPORT local_set + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + else() + install( + TARGETS int-shared + EXPORT shared_set + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) endif() 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}) + install( + TARGETS int-static int-cxx-static int-cxx-headeronly-static + EXPORT static_set + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + install( + TARGETS int-static int-cxx-static int-cxx-headeronly-static libint-Eigen3 + EXPORT local_set + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT Eigen3 + ) + else() + install( + TARGETS int-static + EXPORT static_set + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) endif() endif() @@ -467,13 +485,29 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libint2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/) 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 "${NS}::" + DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + ) 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 "${NS}::" + DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + ) +endif() + +if (EXPORT_LOCAL_TARGETS) + install( + EXPORT local_set + FILE "${pnv}-targets-local.cmake" + NAMESPACE "${NS}::" + DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + ) endif() + From 69d48fb377c3bc0b30a9d3860af2533b74f3d87e Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 18 Jan 2022 13:29:51 -0500 Subject: [PATCH 031/182] move eigen detection to config --- cmake/libint2-config.cmake.in | 20 ++-- cmake/modules/FindTargetEigen3.cmake | 165 +++++++++++++++++++++++++++ src/lib/libint/CMakeLists.txt.export | 82 +++++++------ src/lib/libint/populate.cmake | 1 + 4 files changed, 223 insertions(+), 45 deletions(-) create mode 100644 cmake/modules/FindTargetEigen3.cmake diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index 2a4108521..52f9f72ea 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -273,6 +273,18 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) # project which has already built this as a subproject #----------------------------------------------------------------------------- if(NOT TARGET ${NS}::cxx) + include(CMakeFindDependencyMacro) + if(NOT TARGET tgt::Eigen) + find_dependency(TargetEigen3 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() + endif() + if(_seek_static GREATER -1) include("${CMAKE_CURRENT_LIST_DIR}/${pnv}-targets-static.cmake") elseif(_seek_shared GREATER -1) @@ -283,14 +295,6 @@ if(NOT TARGET ${NS}::cxx) 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::headers) - 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) diff --git a/cmake/modules/FindTargetEigen3.cmake b/cmake/modules/FindTargetEigen3.cmake new file mode 100644 index 000000000..b13bf43a5 --- /dev/null +++ b/cmake/modules/FindTargetEigen3.cmake @@ -0,0 +1,165 @@ +# FindTargetEigen3.cmake +# -------------------- +# +# Eigen3 cmake module to wrap Eigen3 suitable for Libint2, whether Eigen3Config, FindEigen3, or raw variables, in a target. +# +# This module sets the following variables in your project: :: +# +## TargetEigen3_FOUND - true if Eigen3 and all required components found on the system +## TargetEigen3_VERSION - Eigen3 version in format Major.Minor.Release +## TargetEigen3_MESSAGE - status message with Eigen3 library path list and version +## +## Note that components are passed along to find_package(HDF5 (untested) but not checked in the direct TargetHDF5Config +## Note that version checking/attaching not working yet +## +## This module *unsets* the following conventional HDF5 variables so as +## to force using the target: :: +## +## HDF5_FOUND +## HDF5_VERSION +## HDF5_INCLUDE_DIRS +## HDF5_LIBRARIES +## +## Exported targets:: +## +## If Eigen3 is found, this module defines the following :prop_tgt:`IMPORTED` +## target. :: +## +## tgt::Eigen3 - the Eigen3 libraries with headers attached. +## +## Suggested usage:: +## +## find_package(TargetHDF5) +## find_package(TargetHDF5 1.8.16 REQUIRED) +# +# +# The following variables can be set to guide the search for this package:: +# +# TargetEigen3_DIR - CMake variable, set to directory containing this Config file +# CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package + +set(PN TargetEigen3) + +# 1st precedence - libraries passed in through -DHDF5_LIBRARIES +if (HDF5_LIBRARIES AND HDF5_INCLUDE_DIRS) + if (HDF5_VERSION) + if (NOT ${PN}_FIND_QUIETLY) + message (STATUS "HDF5 detection suppressed.") + endif() + + add_library (tgt::hdf5 INTERFACE IMPORTED) + set_property (TARGET tgt::hdf5 PROPERTY INTERFACE_LINK_LIBRARIES ${HDF5_LIBRARIES}) + set_property (TARGET tgt::hdf5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS}) + set (${PN}_VERSION ${HDF5_VERSION}) + else() + message (FATAL_ERROR "Humor the build system - pass in the version, too (for example, -DHDF5_VERSION=1.8.17).") + endif() +else() + # 2nd precedence - target already prepared and findable in TargetEigen3Config.cmake + find_package (TargetEigen3 QUIET CONFIG) + if ((TARGET tgt::Eigen) AND (${PN}_VERSION)) + if (NOT ${PN}_FIND_QUIETLY) + message (STATUS "TargetEigen3Config detected.") + endif() + else() + # 3rd precedence - usual variables from Eigen3Config.cmake + find_package (Eigen3 QUIET CONFIG) +# find_package (Eigen3 QUIET MODULE) +# Eigen3::Eigen + if (NOT ${PN}_FIND_QUIETLY) + message (STATUS "Eigen3 detected.") + endif() + + add_library (tgt::Eigen INTERFACE IMPORTED) + + get_property(_iid1 TARGET Eigen3::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + message("ASDF ${_iid1}") + set_property (TARGET tgt::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_iid1}) +# set_property (TARGET tgt::eigen PROPERTY INTERFACE_LINK_LIBRARIES ${HDF5_LIBRARIES}) + #set_property (TARGET tgt::hdf5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS}) + set (${PN}_VERSION ${Eigen3_VERSION}) + + #unset (HDF5_FOUND) + #unset (HDF5_VERSION) + #unset (HDF5_LIBRARIES) + #unset (HDF5_INCLUDE_DIRS) + endif() +endif() + +get_property(_iid TARGET tgt::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + message("QWER ${_iid}") +set(${PN}_MESSAGE "Found Eigen3: ${_iid} (found version ${${PN}_VERSION})") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(${PN} + REQUIRED_VARS ${PN}_MESSAGE + VERSION_VAR ${PN}_VERSION) + +# FindTargetLAPACK.cmake +# ---------------------- +# +# LAPACK cmake module to wrap FindLAPACK.cmake in a target. +# +# This module sets the following variables in your project: :: +# +# TargetLAPACK_FOUND - true if BLAS/LAPACK found on the system +# TargetLAPACK_MESSAGE - status message with BLAS/LAPACK library path list +# +# This module *unsets* the following conventional LAPACK variables so as +# to force using the target: :: +# +# LAPACK_FOUND +# LAPACK_LIBRARIES +# +# In order of decreasing precedence, this module returns in a target ``tgt::lapack`` +# (1) the libraries passed through CMake variable LAPACK_LIBRARIES, +# (2) the libraries defined in a detectable TargetLAPACKConfig.cmake file +# (skip via DISABLE_FIND_PACKAGE_TargetLAPACK), or +# (3) the libraries detected by the usual FindLAPACK.cmake module. +# + +#set(PN TargetLAPACK) +# +## 1st precedence - libraries passed in through -DLAPACK_LIBRARIES +#if (LAPACK_LIBRARIES) +# if (NOT ${PN}_FIND_QUIETLY) +# message (STATUS "LAPACK detection suppressed.") +# endif() +# +# add_library (tgt::lapack INTERFACE IMPORTED) +# set_property (TARGET tgt::lapack PROPERTY INTERFACE_LINK_LIBRARIES ${LAPACK_LIBRARIES}) +#else() +# # 2nd precedence - target already prepared and findable in TargetLAPACKConfig.cmake +# if (NOT "${DISABLE_FIND_PACKAGE_${PN}}") +# find_package (TargetLAPACK QUIET CONFIG) +# endif() +# if (TARGET tgt::lapack) +# if (NOT ${PN}_FIND_QUIETLY) +# message (STATUS "TargetLAPACKConfig detected.") +# endif() +# else() +# # 3rd precedence - usual variables from FindLAPACK.cmake +# find_package (LAPACK QUIET MODULE) +# if (NOT ${PN}_FIND_QUIETLY) +# message (STATUS "LAPACK detected.") +# endif() +# +# add_library (tgt::lapack INTERFACE IMPORTED) +# set_property (TARGET tgt::lapack PROPERTY INTERFACE_LINK_LIBRARIES ${LAPACK_LIBRARIES}) +# +# unset (LAPACK_FOUND) +# unset (LAPACK_LIBRARIES) +# endif() +#endif() +# +#get_property (_ill TARGET tgt::lapack PROPERTY INTERFACE_LINK_LIBRARIES) +#set (${PN}_MESSAGE "Found LAPACK: ${_ill}") +#if ((TARGET tgt::blas) AND (TARGET tgt::lapk)) +# get_property (_illb TARGET tgt::blas PROPERTY INTERFACE_LINK_LIBRARIES) +# get_property (_illl TARGET tgt::lapk PROPERTY INTERFACE_LINK_LIBRARIES) +# set (${PN}_MESSAGE "Found LAPACK: ${_illl};${_illb}") +#endif() +# +#include(FindPackageHandleStandardArgs) +#find_package_handle_standard_args (${PN} DEFAULT_MSG ${PN}_MESSAGE) +# diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index fe7395548..d5cc948aa 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -108,39 +108,43 @@ else() 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() - # 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() - add_library(libint-Eigen3 INTERFACE) - set_property(TARGET libint-Eigen3 PROPERTY - INTERFACE_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIR}) - endif() - endif() -endif() -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}") -endif() - -if (TARGET libint-Eigen3) +## 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() +# # 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() +# add_library(libint-Eigen3 INTERFACE) +# set_property(TARGET libint-Eigen3 PROPERTY +# INTERFACE_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIR}) +# endif() +# endif() +#endif() +#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}") +#endif() + +#if (TARGET libint-Eigen3) + +find_package(TargetEigen3) # REQUIRED) + +if (TARGET tgt::Eigen) set(LIBINT_HAS_EIGEN 1) set(LIBINT_HAS_CXX_API 1) else() @@ -243,7 +247,7 @@ if (BUILD_SHARED_LIBS) # 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) + target_link_libraries (int-cxx-headeronly-shared INTERFACE int-shared tgt::Eigen) if (TARGET Boost::headers) target_link_libraries (int-cxx-headeronly-shared INTERFACE Boost::headers) endif() @@ -281,7 +285,7 @@ if (BUILD_STATIC_LIBS) # 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) + target_link_libraries (int-cxx-headeronly-static INTERFACE int-static tgt::Eigen) if (TARGET Boost::headers) target_link_libraries (int-cxx-headeronly-static INTERFACE Boost::headers) endif() @@ -422,7 +426,7 @@ if (BUILD_SHARED_LIBS) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) install( - TARGETS int-shared int-cxx-shared int-cxx-headeronly-shared libint-Eigen3 + TARGETS int-shared int-cxx-shared int-cxx-headeronly-shared #tgt::Eigen #libint-Eigen3 EXPORT local_set LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) @@ -443,7 +447,7 @@ if (BUILD_STATIC_LIBS) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) install( - TARGETS int-static int-cxx-static int-cxx-headeronly-static libint-Eigen3 + TARGETS int-static int-cxx-static int-cxx-headeronly-static #tgt::Eigen #libint-Eigen3 EXPORT local_set ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Eigen3 @@ -483,6 +487,10 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config.cmake configure_file(cmake/libint2.pc.cmake.in libint2.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libint2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/) +install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/FindTargetEigen3.cmake + DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + ) if (BUILD_SHARED_LIBS) install( diff --git a/src/lib/libint/populate.cmake b/src/lib/libint/populate.cmake index e39ec5574..e29f2a914 100644 --- a/src/lib/libint/populate.cmake +++ b/src/lib/libint/populate.cmake @@ -52,6 +52,7 @@ file(INSTALL "${PROJECT_SOURCE_DIR}/cmake/modules/autocmake_safeguards.cmake" "${PROJECT_SOURCE_DIR}/cmake/modules/options.cmake" "${PROJECT_SOURCE_DIR}/cmake/modules/FindMPFR.cmake" "${PROJECT_SOURCE_DIR}/cmake/modules/AddCustomTargetSubproject.cmake" + "${PROJECT_SOURCE_DIR}/cmake/modules/FindTargetEigen3.cmake" "${PROJECT_BINARY_DIR}/cmake/modules/int_computed.cmake" DESTINATION "${EXPORT_STAGE_DIR}/cmake/modules") From c13828c0be082daf914d33303169d041f1f388ee Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 18 Jan 2022 15:41:06 -0500 Subject: [PATCH 032/182] fix up after rebase --- cmake/modules/FindTargetEigen3.cmake | 2 -- src/lib/libint/CMakeLists.txt.export | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cmake/modules/FindTargetEigen3.cmake b/cmake/modules/FindTargetEigen3.cmake index b13bf43a5..1fb2b35e4 100644 --- a/cmake/modules/FindTargetEigen3.cmake +++ b/cmake/modules/FindTargetEigen3.cmake @@ -73,7 +73,6 @@ else() add_library (tgt::Eigen INTERFACE IMPORTED) get_property(_iid1 TARGET Eigen3::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES) - message("ASDF ${_iid1}") set_property (TARGET tgt::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_iid1}) # set_property (TARGET tgt::eigen PROPERTY INTERFACE_LINK_LIBRARIES ${HDF5_LIBRARIES}) #set_property (TARGET tgt::hdf5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS}) @@ -87,7 +86,6 @@ else() endif() get_property(_iid TARGET tgt::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES) - message("QWER ${_iid}") set(${PN}_MESSAGE "Found Eigen3: ${_iid} (found version ${${PN}_VERSION})") include(FindPackageHandleStandardArgs) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index d5cc948aa..1b52d19f2 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -209,7 +209,7 @@ endif() 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) + target_link_libraries (int-cxx-obj PRIVATE tgt::Eigen) if (TARGET Boost::boost) target_link_libraries (int-cxx-obj PRIVATE Boost::boost) endif(TARGET Boost::boost) From b15294fb20c9a32bb565f614978829977cd92c62 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 19 Jan 2022 12:55:45 -0500 Subject: [PATCH 033/182] organize lib defs, NS->L2, back to 3 char ordering component in Config --- INSTALL.md | 42 ++++- cmake/libint2-config.cmake.in | 222 +++++++++------------------ cmake/modules/int_am.cmake | 1 - src/lib/libint/CMakeLists.txt | 1 + src/lib/libint/CMakeLists.txt.export | 195 +++++++++++++++-------- 5 files changed, 244 insertions(+), 217 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 0ad2fa8d3..a6e3cb5a6 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -33,6 +33,37 @@ These are the most useful configure options: * `ENABLE_G12` -- Compile with support for N-th derivatives of MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] * `ENABLE_G12DKH` -- 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` -- 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] + +### Ordering Conventions + +* `LIBINT2_SHGAUSS_ORDERING` -- Ordering for shells of solid harmonic Gaussians. Consumed at library build-time. [Default=standard] + * `standard` -- standard ordering (-l, -l+1 ... l) + * `gaussian` -- the Gaussian ordering (0, 1, -1, 2, -2, ... l, -l) +* `LIBINT2_CARTGAUSS_ORDERING` -- Orderings for shells of cartesian Gaussians. Consumed at generator build-time. [Default=standard] + * `standard` -- standard ordering (xxx, xxy, xxz, xyy, xyz, xzz, yyy, ...) + * `intv3` -- intv3 ordering (yyy, yyz, yzz, zzz, xyy, xyz, xzz, xxy, xxz, xxx) + * `gamess` -- GAMESS ordering (xxx, yyy, zzz, xxy, xxz, yyx, yyz, zzx, zzy, xyz) + * `orca` -- ORCA ordering (hydrid between GAMESS and standard) + * `bagel` -- axis-permuted version of intv3 (xxx, xxy, xyy, yyy, xxz, xyz, yyz, xzz, yzz, zzz) +* `LIBINT2_SHELL_SET` -- Support computation of shell sets sets subject to these restrictions. Consumed at generator build-time. [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` -- Assume the 'unpaired' center of 3-center ERIs will be transformed to pure solid harmonics. [Default=OFF] +* `ERI2_PURE_SH` -- Assume the 2-center ERIs will be transformed to pure solid harmonics. [Default=OFF] ### How High Angular Momentum @@ -67,6 +98,12 @@ These are the most useful configure options: * `--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` @@ -98,7 +135,8 @@ These are the most useful configure options: * `-D ENABLE_CXX11API=ON` --> `-D REQUIRE_CXX_API=ON` * Targets - * `libint2` --> `Libint2::int2` (internal target name `int-shared`) - * `libint2_cxx` --> `Libint2::cxx` (internal target name `int-cxx-shared`) + * `libint2` --> `Libint2::int2` (internal target name `int-{shared,static}`) + * `libint2_cxx` --> `Libint2::cxx` (internal target name `int-cxx-headeronly-{shared,static}`) + * DNE --> `Libint2::int2-cxx` (internal target name `int-cxx-{shared,static}`) diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index 52f9f72ea..167df0818 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -22,22 +22,36 @@ # 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) -# -# 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 -# +# 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) +# +# 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: # @@ -46,8 +60,9 @@ # If Libint2 is found, this module defines 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 # # # Suggested usage: @@ -55,7 +70,8 @@ # :: # # 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) +# find_package(Libint2 CONFIG REQUIRED COMPONENTS gss onebody_d0_l4 onebody_d1_l3 onebody_d2_l3 "eri_c4_d0_l${MAX_AM_ERI}" eri_c4_d1_l2 eri_c4_d2_l2 eri_c3_d0_l4 eri_c3_d1_l3 eri_c3_d2_l3 eri_c2_d0_l4 eri_c2_d1_l3 eri_c2_d2_l3) -DERI3_PURE_SH=OFF -DERI2_PURE_SH=OFF # for psi4 # # # The following variables can be set to guide the search for this package: @@ -70,123 +86,35 @@ @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 - eri_c4_d2_l2 - eri_c4_d2_l3 - eri_c4_d2_l4 - eri_c4_d2_l5 - eri_c4_d2_l6 - eri_c4_d2_l7 - eri_c4_d2_l8 - eri_c4_d2_l9 - eri_c4_d2_l10 - - eri_c3_d0_l2 - eri_c3_d0_l3 - eri_c3_d0_l4 - eri_c3_d0_l5 - eri_c3_d0_l6 - eri_c3_d0_l7 - eri_c3_d0_l8 - eri_c3_d0_l9 - eri_c3_d0_l10 - eri_c3_d1_l2 - eri_c3_d1_l3 - eri_c3_d1_l4 - eri_c3_d1_l5 - eri_c3_d1_l6 - eri_c3_d1_l7 - eri_c3_d1_l8 - eri_c3_d1_l9 - eri_c3_d1_l10 - eri_c3_d2_l2 - eri_c3_d2_l3 - eri_c3_d2_l4 - eri_c3_d2_l5 - eri_c3_d2_l6 - eri_c3_d2_l7 - eri_c3_d2_l8 - eri_c3_d2_l9 - eri_c3_d2_l10 - - eri_c2_d0_l2 - eri_c2_d0_l3 - eri_c2_d0_l4 - eri_c2_d0_l5 - eri_c2_d0_l6 - eri_c2_d0_l7 - eri_c2_d0_l8 - eri_c2_d0_l9 - eri_c2_d0_l10 - eri_c2_d1_l2 - eri_c2_d1_l3 - eri_c2_d1_l4 - eri_c2_d1_l5 - eri_c2_d1_l6 - eri_c2_d1_l7 - eri_c2_d1_l8 - eri_c2_d1_l9 - eri_c2_d1_l10 - eri_c2_d2_l2 - eri_c2_d2_l3 - eri_c2_d2_l4 - eri_c2_d2_l5 - eri_c2_d2_l6 - eri_c2_d2_l7 - eri_c2_d2_l8 - eri_c2_d2_l9 - eri_c2_d2_l10 - - ss - so - is - io - gs - go - os - oo - bs - bo -) +set(L2 Libint2) # NameSpace # check library style component if(@BUILD_SHARED_LIBS@) - set(${PN}_shared_FOUND 1) + set(${L2}_shared_FOUND 1) endif() if(@BUILD_STATIC_LIBS@) - set(${PN}_static_FOUND 1) + 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 +set(${L2}_C_FOUND 1) +list(FIND ${L2}_FIND_COMPONENTS "C" _seek_C) +if(@REQUIRE_CXX_API@) + set(${L2}_CXX_FOUND 1) +endif() +list(FIND ${L2}_FIND_COMPONENTS "CXX" _seek_CXX) +if(@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 @@ -231,9 +159,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 @@ -259,11 +187,11 @@ 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: ") + 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}) +check_required_components(${L2}) # make detectable the various cmake modules exported alongside list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) @@ -272,7 +200,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) # 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) include(CMakeFindDependencyMacro) if(NOT TARGET tgt::Eigen) find_dependency(TargetEigen3 REQUIRED) @@ -295,19 +223,19 @@ if(NOT TARGET ${NS}::cxx) include("${CMAKE_CURRENT_LIST_DIR}/${pnv}-targets-static.cmake") 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}::cxx PROPERTY LOCATION) + set(${L2}_LIBRARY ${_loc}) + get_property(_ill TARGET ${L2}::cxx PROPERTY INTERFACE_LINK_LIBRARIES) + set(${L2}_LIBRARIES ${_ill}) + + get_property(_id TARGET ${L2}::cxx PROPERTY INCLUDE_DIRECTORIES) + set(${L2}_INCLUDE_DIR ${_id}) + get_property(_iid TARGET ${L2}::cxx PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + set(${L2}_INCLUDE_DIRS ${_iid}) + + message(DEBUG "Libint2::cxx") + message(DEBUG "loc ${_loc}") + message(DEBUG "ill ${_ill}") + message(DEBUG "id ${_id}") + message(DEBUG "iid ${_iid}") endif() diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index 8ee71e27c..befa5afd3 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -11,7 +11,6 @@ # `find_package(Libint2 COMPONENTS twobody_c4_d1_l5)` -message(STATUS "LAB int.am") message(STATUS "Processing integrals classes ...") # <<< overall derivatives level >>> diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index 23090d50a..bf7e2b7d9 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -87,6 +87,7 @@ else() -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR} -DCMAKE_INSTALL_DATAROOTDIR=${CMAKE_INSTALL_DATAROOTDIR} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} + -DLIBINT2_BUILD_SHARED_AND_STATIC_LIBS=${LIBINT2_BUILD_SHARED_AND_STATIC_LIBS} -DREQUIRE_CXX_API=${REQUIRE_CXX_API} -DENABLE_FORTRAN=${ENABLE_FORTRAN} -DLIBINT2_SHGAUSS_ORDERING=${LIBINT2_SHGAUSS_ORDERING} diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 1b52d19f2..e7188408c 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -3,13 +3,12 @@ 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") +set(Libint2_AUTHORS "Edward F. Valeev") +set(Libint2_DESCRIPTION "High-performance library for computing Gaussian integrals in quantum mechanics") +set(Libint2_URL "https://github.com/evaleev/libint") +set(Libint2_LICENSE "LGPL-3.0") -set(NS Libint2) # Namespace -set(PN ${PROJECT_NAME}) # ProjectName +set(L2 Libint2) # Namespace set(pnv libint2) # projectnameversion list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) @@ -142,7 +141,7 @@ endif() #if (TARGET libint-Eigen3) -find_package(TargetEigen3) # REQUIRED) +find_package(TargetEigen3 MODULE) if (TARGET tgt::Eigen) set(LIBINT_HAS_EIGEN 1) @@ -187,11 +186,18 @@ include(srclist.cmake) message(STATUS "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/ @@ -200,119 +206,173 @@ 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) endif() if (NOT BUILD_SHARED_LIBS OR LIBINT2_BUILD_SHARED_AND_STATIC_LIBS) set(BUILD_STATIC_LIBS 1) endif() -# if building CXX API make an object files needed for non-header-only version +# if building CXX API, make an object lib 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 tgt::Eigen) - if (TARGET Boost::boost) - target_link_libraries (int-cxx-obj PRIVATE Boost::boost) - endif(TARGET Boost::boost) + + target_compile_definitions( + int-cxx-obj + PUBLIC + LIBINT2_DOES_NOT_INLINE_ENGINE=1 + __COMPILING_LIBINT2=1 + ) + 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) + + if (BUILD_SHARED_LIBS) set_target_properties(int-cxx-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) endif() -endif() -if (MSVC) - # Increase stack size from 1 MB to 4 MB - set_target_properties(int-obj PROPERTIES LINK_FLAGS "/STACK:4194304") + target_include_directories( + int-cxx-obj + PRIVATE + ${PROJECT_BINARY_DIR}/include/ + ${PROJECT_SOURCE_DIR}/src/ + ${PROJECT_SOURCE_DIR}/include/ + ${PROJECT_BINARY_DIR}/include/libint2/ + ) + + target_link_libraries (int-cxx-obj PRIVATE tgt::Eigen) + if (TARGET Boost::headers) + target_link_libraries (int-cxx-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 $) + 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" + ) + + 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 tgt::Eigen) - if (TARGET Boost::headers) - target_link_libraries (int-cxx-headeronly-shared INTERFACE Boost::headers) - endif() - target_compile_features(int-cxx-headeronly-shared INTERFACE "cxx_std_11") + target_compile_definitions( int-cxx-headeronly-shared INTERFACE $ $ ) + + 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 tgt::Eigen) + if (TARGET Boost::headers) + target_link_libraries (int-cxx-headeronly-shared INTERFACE Boost::headers) + endif() + # 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") + 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) 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") + 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 tgt::Eigen) - if (TARGET Boost::headers) - target_link_libraries (int-cxx-headeronly-static INTERFACE Boost::headers) - endif() - target_compile_features(int-cxx-headeronly-static INTERFACE "cxx_std_11") + target_compile_definitions( int-cxx-headeronly-static INTERFACE $ $ ) + + 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 tgt::Eigen) + if (TARGET Boost::headers) + target_link_libraries (int-cxx-headeronly-static INTERFACE Boost::headers) + endif() + # 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") + 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) endif() if (BUILD_SHARED_LIBS) add_library (int-library ALIAS int-shared) + if (TARGET int-cxx-headeronly-shared) + add_library (int-cxx-headeronly-library ALIAS int-cxx-headeronly-shared) + endif() if (TARGET int-cxx-shared) add_library (int-cxx-library ALIAS int-cxx-shared) endif() elseif (BUILD_STATIC_LIBS) add_library (int-library ALIAS int-static) + if (TARGET int-cxx-headeronly-static) + add_library (int-cxx-headeronly-library ALIAS int-cxx-headeronly-static) + endif() if (TARGET int-cxx-static) add_library (int-cxx-library ALIAS int-cxx-static) endif() @@ -421,7 +481,8 @@ install(FILES ${PROJECT_SOURCE_DIR}/src/libint2_iface.h if (BUILD_SHARED_LIBS) if (TARGET int-cxx-headeronly-shared AND TARGET int-cxx-shared) install( - TARGETS int-shared int-cxx-shared int-cxx-headeronly-shared + #TARGETS int-shared int-cxx-shared int-cxx-headeronly-shared + TARGETS int-shared int-cxx-headeronly-shared EXPORT shared_set LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) @@ -496,7 +557,7 @@ if (BUILD_SHARED_LIBS) install( EXPORT shared_set FILE "${pnv}-targets-shared.cmake" - NAMESPACE "${NS}::" + NAMESPACE "${L2}::" DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) endif() @@ -505,7 +566,7 @@ if (BUILD_STATIC_LIBS) install( EXPORT static_set FILE "${pnv}-targets-static.cmake" - NAMESPACE "${NS}::" + NAMESPACE "${L2}::" DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) endif() @@ -514,7 +575,7 @@ if (EXPORT_LOCAL_TARGETS) install( EXPORT local_set FILE "${pnv}-targets-local.cmake" - NAMESPACE "${NS}::" + NAMESPACE "${L2}::" DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) endif() From 14b875c6a77195623bde22945e7395b529dd52ef Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 19 Jan 2022 17:29:25 -0500 Subject: [PATCH 034/182] target documentation --- INSTALL.md | 115 +++++++++++++++++++++++----------- src/lib/libint/CMakeLists.txt | 1 + 2 files changed, 81 insertions(+), 35 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index a6e3cb5a6..fd4dc6f9d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -16,6 +16,42 @@ For (more) complete instructions please refer to https://github.com/evaleev/libi #################### +target includes steps (see below) +------ -------------------------- +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 + + +The build is structured into three parts: + +* generator + - (1) build src/bin/libint/ into generator/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. + - 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 build as a subproject (FetchContent) or completely insulated (bare ExternalProject; default) + - if building via bare ExternalProject: + - (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 + - if building via FetchContent: + - must build libint-library-export target before library *build* targets appear ----------------------------------------------------------------------------- ## configuring libint compiler @@ -26,71 +62,78 @@ These are the most useful configure options: ### Which Integrals Classes, Which Derivative Levels -* `ENABLE_ONEBODY` -- Compile with support for up to N-th derivatives of 1-body integrals. Use -1 for OFF. [Default=0] -* `ENABLE_ERI` -- Compile with support for up to N-th derivatives of 4-center electron repulsion integrals. Use -1 for OFF. [Default=0] -* `ENABLE_ERI3` -- Compile with support for up to N-th derivatives of 3-center electron repulsion integrals. Use -1 for OFF. [Default=-1] -* `ENABLE_ERI2` -- Compile with support for up to N-th derivatives of 2-center electron repulsion integrals. Use -1 for OFF. [Default=-1] -* `ENABLE_G12` -- Compile with support for N-th derivatives of MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] -* `ENABLE_G12DKH` -- Compile with support for N-th derivatives of DKH-MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] +* `ENABLE_ONEBODY` — Compile with support for up to N-th derivatives of 1-body integrals. Use -1 for OFF. [Default=0] +* `ENABLE_ERI` — Compile with support for up to N-th derivatives of 4-center electron repulsion integrals. Use -1 for OFF. [Default=0] +* `ENABLE_ERI3` — Compile with support for up to N-th derivatives of 3-center electron repulsion integrals. Use -1 for OFF. [Default=-1] +* `ENABLE_ERI2` — Compile with support for up to N-th derivatives of 2-center electron repulsion integrals. Use -1 for OFF. [Default=-1] +* `ENABLE_G12` — Compile with support for N-th derivatives of MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] +* `ENABLE_G12DKH` — 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` -- Disable geometric derivatives of 1-body property integrals (all but overlap, kinetic, elecpot). +* `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. Use OFF to enable. [Default=ON] ### Ordering Conventions -* `LIBINT2_SHGAUSS_ORDERING` -- Ordering for shells of solid harmonic Gaussians. Consumed at library build-time. [Default=standard] - * `standard` -- standard ordering (-l, -l+1 ... l) - * `gaussian` -- the Gaussian ordering (0, 1, -1, 2, -2, ... l, -l) -* `LIBINT2_CARTGAUSS_ORDERING` -- Orderings for shells of cartesian Gaussians. Consumed at generator build-time. [Default=standard] - * `standard` -- standard ordering (xxx, xxy, xxz, xyy, xyz, xzz, yyy, ...) - * `intv3` -- intv3 ordering (yyy, yyz, yzz, zzz, xyy, xyz, xzz, xxy, xxz, xxx) - * `gamess` -- GAMESS ordering (xxx, yyy, zzz, xxy, xxz, yyx, yyz, zzx, zzy, xyz) - * `orca` -- ORCA ordering (hydrid between GAMESS and standard) - * `bagel` -- axis-permuted version of intv3 (xxx, xxy, xyy, yyy, xxz, xyz, yyz, xzz, yzz, zzz) -* `LIBINT2_SHELL_SET` -- Support computation of shell sets sets subject to these restrictions. Consumed at generator build-time. [Default=standard] - * `standard` -- standard ordering: +* `LIBINT2_SHGAUSS_ORDERING` — Ordering for shells of solid harmonic Gaussians. Consumed at library build-time. [Default=standard] + * `standard` — standard ordering (-l, -l+1 ... l) + * `gaussian` — the Gaussian ordering (0, 1, -1, 2, -2, ... l, -l) +* `LIBINT2_CARTGAUSS_ORDERING` — Orderings for shells of cartesian Gaussians. Consumed at generator build-time. [Default=standard] + * `standard` — standard ordering (xxx, xxy, xxz, xyy, xyz, xzz, yyy, ...) + * `intv3` — intv3 ordering (yyy, yyz, yzz, zzz, xyy, xyz, xzz, xxy, xxz, xxx) + * `gamess` — GAMESS ordering (xxx, yyy, zzz, xxy, xxz, yyx, yyz, zzx, zzy, xyz) + * `orca` — ORCA ordering (hydrid between GAMESS and standard) + * `bagel` — axis-permuted version of intv3 (xxx, xxy, xyy, yyy, xxz, xyz, yyz, xzz, yzz, zzz) +* `LIBINT2_SHELL_SET` — Support computation of shell sets sets subject to these restrictions. Consumed at generator build-time. [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: + * `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` -- Assume the 'unpaired' center of 3-center ERIs will be transformed to pure solid harmonics. [Default=OFF] -* `ERI2_PURE_SH` -- Assume the 2-center ERIs will be transformed to pure solid harmonics. [Default=OFF] +* `ERI3_PURE_SH` — Assume the 'unpaired' center of 3-center ERIs will be transformed to pure solid harmonics. [Default=OFF] +* `ERI2_PURE_SH` — Assume the 2-center ERIs will be transformed to pure solid harmonics. [Default=OFF] ### How High Angular Momentum -# example for "semicolon-separated string": `-DENABLE_ERI3=2 -DWITH_ERI3_MAX_AM="5;4;3"` +* Notes + * example for "semicolon-separated string": `-DENABLE_ERI3=2 -DWITH_ERI3_MAX_AM="5;4;3"`. cmake configuration prints: -# high MAX_AM generating >20k files may require `ulimit -s 65535` for linking library target on Linux to avert "ld: Argument list too long" + ``` + -- Setting option ENABLE_ERI3: 2 + -- Setting option WITH_ERI3_MAX_AM: 5;4;3 + ``` -* `WITH_MAX_AM` -- Support Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. [Default=4] -* `WITH_OPT_AM` -- 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`] + * high MAX_AM generating >20k files may require `ulimit -s 65535` for linking library target on Linux to avert "ld: Argument list too long" -* `WITH_ONEBODY_MAX_AM` -- 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` -- 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_MAX_AM` — Support Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. [Default=4] +* `WITH_OPT_AM` — 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`] -* `WITH_ERI_MAX_AM` -- 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` -- 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_ONEBODY_MAX_AM` — 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` — 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_ERI3_MAX_AM` -- 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` -- 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_ERI_MAX_AM` — 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` — 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_ERI2_MAX_AM` -- 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` -- 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_ERI3_MAX_AM` — 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` — 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` — 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` — 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`] ### Autotools Update Guide -* When three option names present, they are for libtool+cmake --> cmake+cmake (c. #148 for Psi4 c. 2020-2021) --> cmake+cmake +* 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` @@ -131,9 +174,11 @@ These are the most useful configure options: * `--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 BUILD_SHARED_LIBS=ON -D LIBINT2_BUILD_SHARED_AND_STATIC_LIBS=ON` +* `--enable-shared --enable-static` --> `-D BUILD_SHARED=ON -D BUILD_STATIC=ON` --> `-D LIBINT2_BUILD_SHARED_AND_STATIC_LIBS=ON` * `-D ENABLE_CXX11API=ON` --> `-D REQUIRE_CXX_API=ON` +* `--prefix=path` --> `-D CMAKE_INSTALL_PREFIX=path` (standard CMake variable) + * Targets * `libint2` --> `Libint2::int2` (internal target name `int-{shared,static}`) * `libint2_cxx` --> `Libint2::cxx` (internal target name `int-cxx-headeronly-{shared,static}`) diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index bf7e2b7d9..2c866555b 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -46,6 +46,7 @@ if (LIBINT_BUILD_LIBRARY_AS_SUBPROJECT) else() add_custom_target(libint-library-export DEPENDS "${EXPORT_STAGE_DIR}.tgz") endif() +add_custom_target(export DEPENDS libint-library-export) # <<< Build Library >>> From 6828c7d6f2f429e8f8f10490da136dd4bd5bb46f Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 20 Jan 2022 12:05:39 -0500 Subject: [PATCH 035/182] hide libtool files --- INSTALL.md | 32 ++++++++++--------- .../libint2 => archive_libtool}/config.h.in | 0 configure.ac => archive_libtool/configure.ac | 0 3 files changed, 17 insertions(+), 15 deletions(-) rename {include/libint2 => archive_libtool}/config.h.in (100%) rename configure.ac => archive_libtool/configure.ac (100%) diff --git a/INSTALL.md b/INSTALL.md index fd4dc6f9d..2396fb66b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -16,14 +16,16 @@ For (more) complete instructions please refer to https://github.com/evaleev/libi #################### -target includes steps (see below) ------- -------------------------- -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 + + +| target | incl. | steps | ( | see | below | ) | +| ------ | ----- | ----- | ----- | ----- | ----- | ----- | +| 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 | The build is structured into three parts: @@ -72,17 +74,17 @@ These are the most useful configure options: * `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. Use OFF to enable. [Default=ON] -### Ordering Conventions +### Which Ordering Convention * `LIBINT2_SHGAUSS_ORDERING` — Ordering for shells of solid harmonic Gaussians. Consumed at library build-time. [Default=standard] * `standard` — standard ordering (-l, -l+1 ... l) * `gaussian` — the Gaussian ordering (0, 1, -1, 2, -2, ... l, -l) * `LIBINT2_CARTGAUSS_ORDERING` — Orderings for shells of cartesian Gaussians. Consumed at generator build-time. [Default=standard] - * `standard` — standard ordering (xxx, xxy, xxz, xyy, xyz, xzz, yyy, ...) - * `intv3` — intv3 ordering (yyy, yyz, yzz, zzz, xyy, xyz, xzz, xxy, xxz, xxx) - * `gamess` — GAMESS ordering (xxx, yyy, zzz, xxy, xxz, yyx, yyz, zzx, zzy, xyz) - * `orca` — ORCA ordering (hydrid between GAMESS and standard) - * `bagel` — axis-permuted version of intv3 (xxx, xxy, xyy, yyy, xxz, xyz, yyz, xzz, yzz, zzz) + * `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` — Support computation of shell sets sets subject to these restrictions. Consumed at generator build-time. [Default=standard] * `standard` — standard ordering: for (ab|cd): @@ -130,7 +132,7 @@ These are the most useful configure options: -### Autotools Update Guide +## 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 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 From 2d32dffab72c1fad7e5ed583602e9ae2f6d4e05b Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 20 Jan 2022 16:05:03 -0500 Subject: [PATCH 036/182] reconsolidate version storage, computing, and transfer. get basis sets installed in versioned folder again. --- CMakeLists.txt | 36 +++++++++--------- INSTALL.md | 9 +++++ cmake/modules/int_computed.cmake.in | 15 ++------ cmake/modules/int_versions.cmake | 55 ++++++++++++---------------- src/lib/libint/CMakeLists.txt | 1 - src/lib/libint/CMakeLists.txt.export | 29 +++++++++------ 6 files changed, 71 insertions(+), 74 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4490b2b88..02d42302d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,26 +1,25 @@ cmake_minimum_required(VERSION 3.18) # LIST SORT NATURAL +cmake_policy(SET CMP0074 NEW) + +############################# Version and Metadata ############################# + +project( + Libint2Compiler + VERSION 2.7.0 + 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 "GPL-3.0 for generator; LGPL-3.0 for generated") -project(Libint2Compiler - LANGUAGES CXX) -set(Libint2_AUTHORS "Edward F. Valeev") -set(Libint2_DESCRIPTION "High-performance library for computing Gaussian integrals in quantum mechanics") -set(Libint2_URL "https://github.com/evaleev/libint") -set(Libint2_LICENSE "GPL-3.0 for generator; LGPL-3.0 for generated") - -# Set Libint version =================================================================================================== -set(LIBINT_MAJOR_VERSION 2) -set(LIBINT_MINOR_VERSION 7) -set(LIBINT_MICRO_VERSION 0) +# along with project(... VERSION) above, these are the authoritative version source (formerly in configure.ac) set(LIBINT_BUILDID "beta.6") -set(LIBINT_VERSION "${LIBINT_MAJOR_VERSION}.${LIBINT_MINOR_VERSION}.${LIBINT_MICRO_VERSION}") -if (LIBINT_BUILDID) - set(LIBINT_EXT_VERSION "${LIBINT_MAJOR_VERSION}.${LIBINT_MINOR_VERSION}.${LIBINT_MICRO_VERSION}-${LIBINT_BUILDID}") -else() - set(LIBINT_EXT_VERSION ${LIBINT_VERSION}) -endif() +set(LIBINT_SOVERSION "2:3:0") -cmake_policy(SET CMP0074 NEW) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) +include(int_versions) ################################### Overview ################################### @@ -59,7 +58,6 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) # - must build libint-library-export target before library *build* targets appear ################################### Options #################################### -include(int_versions) include(options) include(CTest) # defines BUILD_TESTING option message(STATUS "Building using CMake ${CMAKE_VERSION}") diff --git a/INSTALL.md b/INSTALL.md index 2396fb66b..c6c32e708 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -16,6 +16,15 @@ For (more) complete instructions please refer to https://github.com/evaleev/libi #################### +# CMake build overview: +# +# >>> ls +# cmake/ COPYING src/ tests/ ... +# >>> cmake -S. -Bbuild -GNinja -DCMAKE_INSTALL_PREFIX=/path/to/install-libint ... +# ... +# -- Generating done +# -- Build files have been written to: /current/dir/build +# >>> cmake --build build --target install -j`getconf _NPROCESSORS_ONLN` | target | incl. | steps | ( | see | below | ) | diff --git a/cmake/modules/int_computed.cmake.in b/cmake/modules/int_computed.cmake.in index c995e3052..73d8644f4 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,13 +31,6 @@ 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@") 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/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index 2c866555b..54feb043a 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -27,7 +27,6 @@ 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) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index e7188408c..8e15a9d46 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -1,18 +1,25 @@ cmake_minimum_required(VERSION 3.18) # LIST SORT NATURAL cmake_policy(SET CMP0074 NEW) -project(Libint2 - LANGUAGES CXX) -set(Libint2_AUTHORS "Edward F. Valeev") -set(Libint2_DESCRIPTION "High-performance library for computing Gaussian integrals in quantum mechanics") -set(Libint2_URL "https://github.com/evaleev/libint") -set(Libint2_LICENSE "LGPL-3.0") +############################# Version and Metadata ############################# + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) +include(int_computed) + +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 -list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) - ################################### Overview ################################### # * high MAX_AM generating >20k files may require `ulimit -s 65535` for linking @@ -22,8 +29,6 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) ################################### Options #################################### include(options) -include(int_computed) - # <<< General >>> @@ -170,6 +175,8 @@ include(CMakePackageConfigHelpers) # use defaults, but define another for CMake files set(CMAKE_INSTALL_CMAKEDIR "lib/cmake/${pnv}" CACHE PATH "Installation directory for CMake files") +set(LIBINT2_INSTALL_BASISDIR "${CMAKE_INSTALL_DATADIR}/libint/${LIBINT_VERSION}" + CACHE PATH "LIBINT2 DATA install directory") # <<< Build >>> @@ -524,7 +531,7 @@ endif() # install basis set library install(DIRECTORY ${PROJECT_SOURCE_DIR}/lib/basis - DESTINATION "${CMAKE_INSTALL_DATADIR}" + DESTINATION "${LIBINT2_INSTALL_BASISDIR}" ) if (BUILD_TESTING) From 23091755476e39ad22a568116f701a74695581e7 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 20 Jan 2022 16:50:50 -0500 Subject: [PATCH 037/182] 2.7.1 -> 2.7.0 btwn configure.ac -> CMakeLists.txt --- .github/workflows/cmake.yml | 2 +- INSTALL.md | 75 +++++++++++++++++++------------------ 2 files changed, 40 insertions(+), 37 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index e790fc7d8..9fa7ddf56 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -125,7 +125,7 @@ jobs: cat > CMakeLists.txt <>> ls -# cmake/ COPYING src/ tests/ ... -# >>> cmake -S. -Bbuild -GNinja -DCMAKE_INSTALL_PREFIX=/path/to/install-libint ... -# ... -# -- Generating done -# -- Build files have been written to: /current/dir/build -# >>> cmake --build build --target install -j`getconf _NPROCESSORS_ONLN` +CMake build overview: + +```bash +>>> ls +cmake/ COPYING src/ tests/ ... +>>> cmake -S. -Bbuild -GNinja -DCMAKE_INSTALL_PREFIX=/path/to/install-libint ... +... +-- Generating done +-- Build files have been written to: /current/dir/build +>>> cmake --build build --target install -j`getconf _NPROCESSORS_ONLN` +``` | target | incl. | steps | ( | see | below | ) | @@ -65,36 +64,40 @@ The build is structured into three parts: - must build libint-library-export target before library *build* targets appear ----------------------------------------------------------------------------- -## configuring libint compiler +# configuring libint generator These are the most useful configure options: - +* Notes + * Codes "G", "L", or "GL" for each option indicate whether it is consumed by the generator, the library, or both. + * 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` — Compile with support for up to N-th derivatives of 1-body integrals. Use -1 for OFF. [Default=0] -* `ENABLE_ERI` — Compile with support for up to N-th derivatives of 4-center electron repulsion integrals. Use -1 for OFF. [Default=0] -* `ENABLE_ERI3` — Compile with support for up to N-th derivatives of 3-center electron repulsion integrals. Use -1 for OFF. [Default=-1] -* `ENABLE_ERI2` — Compile with support for up to N-th derivatives of 2-center electron repulsion integrals. Use -1 for OFF. [Default=-1] -* `ENABLE_G12` — Compile with support for N-th derivatives of MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] -* `ENABLE_G12DKH` — Compile with support for N-th derivatives of DKH-MP2-F12 energies with Gaussian factors. Use -1 for OFF. [Default=-1] +* `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` — Disable geometric derivatives of 1-body property integrals (all but overlap, kinetic, elecpot). +* `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] ### Which Ordering Convention -* `LIBINT2_SHGAUSS_ORDERING` — Ordering for shells of solid harmonic Gaussians. Consumed at library build-time. [Default=standard] +* `LIBINT2_SHGAUSS_ORDERING` — L — Ordering for shells of solid harmonic Gaussians. Consumed at library build-time. [Default=standard] * `standard` — standard ordering (-l, -l+1 ... l) * `gaussian` — the Gaussian ordering (0, 1, -1, 2, -2, ... l, -l) -* `LIBINT2_CARTGAUSS_ORDERING` — Orderings for shells of cartesian Gaussians. Consumed at generator build-time. [Default=standard] +* `LIBINT2_CARTGAUSS_ORDERING` — G — Orderings for shells of cartesian Gaussians. Consumed at generator build-time. [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` — Support computation of shell sets sets subject to these restrictions. Consumed at generator build-time. [Default=standard] +* `LIBINT2_SHELL_SET` — G — Support computation of shell sets sets subject to these restrictions. Consumed at generator build-time. [Default=standard] * `standard` — standard ordering: for (ab|cd): l(a) >= l(b), @@ -109,8 +112,8 @@ These are the most useful configure options: l(a) < l(c) || (l(a) == l(c) && l(b) < l(d)) for (b|cd): l(c) <= l(d) -* `ERI3_PURE_SH` — Assume the 'unpaired' center of 3-center ERIs will be transformed to pure solid harmonics. [Default=OFF] -* `ERI2_PURE_SH` — Assume the 2-center ERIs will be transformed to pure solid harmonics. [Default=OFF] +* `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 @@ -124,20 +127,20 @@ These are the most useful configure options: * high MAX_AM generating >20k files may require `ulimit -s 65535` for linking library target on Linux to avert "ld: Argument list too long" -* `WITH_MAX_AM` — Support Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. [Default=4] -* `WITH_OPT_AM` — 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`] +* `WITH_MAX_AM` — G — Support Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. [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`] -* `WITH_ONEBODY_MAX_AM` — 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` — 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_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` — 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` — 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_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` — 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` — 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_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` — 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` — 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_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`] From 6fb5bae8e2bf12597eaedc41d304ba4fbf8a2f5a Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 20 Jan 2022 21:58:02 -0500 Subject: [PATCH 038/182] fix datadir --- INSTALL.md | 8 ++++++-- src/lib/libint/CMakeLists.txt.export | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index f501aadc3..b2d1bf52a 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -18,7 +18,7 @@ CMake build overview: ```bash >>> ls cmake/ COPYING src/ tests/ ... ->>> cmake -S. -Bbuild -GNinja -DCMAKE_INSTALL_PREFIX=/path/to/install-libint ... +>>> cmake -S. -Bbuild -GNinja -DCMAKE_INSTALL_PREFIX=/path/to/future/install-libint ... ... -- Generating done -- Build files have been written to: /current/dir/build @@ -52,7 +52,7 @@ The build is structured into three parts: - consumes no options - build target `export` to stop after this step and collect source tarball * library - - can be build as a subproject (FetchContent) or completely insulated (bare ExternalProject; default) + - can be built as a subproject (FetchContent) or completely insulated (bare ExternalProject; default) - if building via bare ExternalProject: - (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 @@ -130,6 +130,8 @@ These are the most useful configure options: * `WITH_MAX_AM` — G — Support Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. [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`] @@ -166,6 +168,8 @@ These are the most useful configure options: * `--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` diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 8e15a9d46..457f7de51 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -283,7 +283,7 @@ if (BUILD_SHARED_LIBS) int-cxx-headeronly-shared INTERFACE $ - $ + $ ) target_compile_features(int-cxx-headeronly-shared INTERFACE "cxx_std_11") From f8699605b801bb7f5e672371e95cb5cb43a9b7cb Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 21 Jan 2022 00:47:39 -0500 Subject: [PATCH 039/182] one more fix --- INSTALL.md | 14 ++++++++++++++ src/lib/libint/CMakeLists.txt.export | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index b2d1bf52a..246661cae 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,3 +1,17 @@ +# libint compiler vs library + +Before you read on: + +* 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 know how to _generate_ a libint _library_ using the libint _compiler_, first make sure you really need to do that: + * 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 do need to make a custom library, _read on_ + + + # Synopsis - configure: `cmake -S /path/to/compiler/source/tree -B build [-Dvar1=value1] [-Dvar2=value2] ...` where diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 457f7de51..e68a8371e 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -341,7 +341,7 @@ if (BUILD_STATIC_LIBS) int-cxx-headeronly-static INTERFACE $ - $ + $ ) target_compile_features(int-cxx-headeronly-static INTERFACE "cxx_std_11") From abe04cca4dbc333ac25ce024cf85b9ce059bdfd3 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 21 Jan 2022 14:15:44 -0500 Subject: [PATCH 040/182] allow and document non-standard install locations --- INSTALL.md | 13 ++++++++- src/lib/libint/CMakeLists.txt | 17 +++++++----- src/lib/libint/CMakeLists.txt.export | 40 ++++++++++++++++------------ 3 files changed, 45 insertions(+), 25 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 246661cae..7ae2614e6 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -8,7 +8,7 @@ Before you read on: * If you want to know how to _generate_ a libint _library_ using the libint _compiler_, first make sure you really need to do that: * 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 do need to make a custom library, _read on_ + * if you _do_ need to make a custom library, _read on_ @@ -158,6 +158,17 @@ These are the most useful configure options: * `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`] +### Miscellaneous + +* Notes + * Approximate defaults are shown. Actual defaults from [GNUInstallDirs](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html) + +* `CMAKE_INSTALL_BINDIR` — L — Directory to which executables and runtime libraries are installed. [Default=bin] +* `CMAKE_INSTALL_LIBDIR` — L — Directory to which libraries are installed. [Default=lib] +* `CMAKE_INSTALL_INCLUDEDIR` — L — Directory to which headers are installed. [Default=include] +* `CMAKE_INSTALL_DATADIR` — L — Directory to which data files are installed. [Default=share] +* `LIBINT2_INSTALL_CMAKEDIR` — L — Directory to which CMake files are installed. [Default=lib/cmake/libint2] +* `LIBINT2_INSTALL_BASISDIR` — L — Directory to which data (basis) files are installed. basis/ directory created within this. [Default=share/libint/] ## Autotools Update Guide diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index 54feb043a..58554d9b6 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -83,9 +83,12 @@ else() -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} @@ -125,7 +128,7 @@ else() 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) @@ -138,10 +141,10 @@ else() DEPENDS library-configure) 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() diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index e68a8371e..fb4bc108e 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -28,6 +28,7 @@ set(pnv libint2) # projectnameversion # libint2/boost headers are installed or not ################################### Options #################################### +include(GNUInstallDirs) include(options) # <<< General >>> @@ -70,7 +71,20 @@ message(STATUS "Setting option LIBINT2_SHELL_SET: ${LIBINT2_SHELL_SET} (read-onl # <<< Miscellaneous >>> +# * use GNUInstallDirs defaults, but define others for CMake and basis files +# * LIBINT2_ dirs are STRING, not PATH, to preserve relative paths + +message(STATUS "Showing option CMAKE_INSTALL_BINDIR: ${CMAKE_INSTALL_BINDIR}") option_with_default(CMAKE_INSTALL_LIBDIR "Directory to which libraries installed" lib) +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 "Setting 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 "Setting option LIBINT2_INSTALL_BASISDIR: ${LIBINT2_INSTALL_BASISDIR}") + ######################## Process & Validate Options ########################### include(autocmake_safeguards) @@ -167,17 +181,8 @@ endif() ################################# 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") -set(LIBINT2_INSTALL_BASISDIR "${CMAKE_INSTALL_DATADIR}/libint/${LIBINT_VERSION}" - CACHE PATH "LIBINT2 DATA install directory") - # <<< Build >>> if(MSVC) @@ -530,9 +535,10 @@ if (BUILD_STATIC_LIBS) endif() # install basis set library -install(DIRECTORY ${PROJECT_SOURCE_DIR}/lib/basis - DESTINATION "${LIBINT2_INSTALL_BASISDIR}" - ) +install( + DIRECTORY ${PROJECT_SOURCE_DIR}/lib/basis + DESTINATION "${LIBINT2_INSTALL_BASISDIR}" + ) if (BUILD_TESTING) enable_testing(true) @@ -544,20 +550,20 @@ endif() # 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}) + INSTALL_DESTINATION ${LIBINT2_INSTALL_CMAKEDIR}) 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}) + DESTINATION ${LIBINT2_INSTALL_CMAKEDIR}) configure_file(cmake/libint2.pc.cmake.in libint2.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libint2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/) install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/FindTargetEigen3.cmake - DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} ) if (BUILD_SHARED_LIBS) @@ -565,7 +571,7 @@ if (BUILD_SHARED_LIBS) EXPORT shared_set FILE "${pnv}-targets-shared.cmake" NAMESPACE "${L2}::" - DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} ) endif() @@ -574,7 +580,7 @@ if (BUILD_STATIC_LIBS) EXPORT static_set FILE "${pnv}-targets-static.cmake" NAMESPACE "${L2}::" - DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} ) endif() From 4ce4105295281b6ebf7345e090295362e7990dcf Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 21 Jan 2022 16:30:41 -0500 Subject: [PATCH 041/182] paths take 2 --- CMakeLists.txt | 23 +++++++++++++++++++++-- src/lib/libint/CMakeLists.txt.export | 9 +++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 02d42302d..caf1e8aa3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,9 @@ set(LIBINT_SOVERSION "2:3:0") list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) include(int_versions) +set(L2 Libint2) # Namespace +set(pnv libint2) # projectnameversion + ################################### Overview ################################### # CMake build overview: @@ -59,6 +62,7 @@ include(int_versions) ################################### Options #################################### include(options) +include(GNUInstallDirs) include(CTest) # defines BUILD_TESTING option message(STATUS "Building using CMake ${CMAKE_VERSION}") @@ -205,7 +209,23 @@ option_with_print(LIBINT_ENABLE_GENERIC_CODE 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) + +# <<< 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 + +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 @@ -285,7 +305,6 @@ 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) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index fb4bc108e..a2fc4cb65 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -71,20 +71,21 @@ message(STATUS "Setting option LIBINT2_SHELL_SET: ${LIBINT2_SHELL_SET} (read-onl # <<< Miscellaneous >>> +# <<< Path >>> + # * use GNUInstallDirs defaults, but define others for CMake and basis files # * LIBINT2_ dirs are STRING, not PATH, to preserve relative paths message(STATUS "Showing option CMAKE_INSTALL_BINDIR: ${CMAKE_INSTALL_BINDIR}") -option_with_default(CMAKE_INSTALL_LIBDIR "Directory to which libraries installed" lib) +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 "Setting option LIBINT2_INSTALL_CMAKEDIR: ${LIBINT2_INSTALL_CMAKEDIR}") +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 "Setting option LIBINT2_INSTALL_BASISDIR: ${LIBINT2_INSTALL_BASISDIR}") - +message(STATUS "Showing option LIBINT2_INSTALL_BASISDIR: ${LIBINT2_INSTALL_BASISDIR}") ######################## Process & Validate Options ########################### include(autocmake_safeguards) From 2c60cd34d16c03bb9bb7edcab9a5e39dd44010a5 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Fri, 21 Jan 2022 16:39:18 -0500 Subject: [PATCH 042/182] fixup --- src/lib/libint/CMakeLists.txt.export | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index a2fc4cb65..e9b795292 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -590,7 +590,7 @@ if (EXPORT_LOCAL_TARGETS) EXPORT local_set FILE "${pnv}-targets-local.cmake" NAMESPACE "${L2}::" - DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} ) endif() From 6ba89f8d31d385700be702b261c22ae1c1044129 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 21 Jan 2022 16:58:13 -0500 Subject: [PATCH 043/182] reconcile line numbers --- src/lib/libint/CMakeLists.txt.export | 72 ++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index e9b795292..0685c7680 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -494,17 +494,47 @@ install(FILES ${PROJECT_SOURCE_DIR}/src/libint2_iface.h if (BUILD_SHARED_LIBS) if (TARGET int-cxx-headeronly-shared AND TARGET int-cxx-shared) install( - #TARGETS int-shared int-cxx-shared int-cxx-headeronly-shared - TARGETS int-shared int-cxx-headeronly-shared + TARGETS + int-shared + int-cxx-shared + int-cxx-headeronly-shared + #TARGETS int-shared int-cxx-headeronly-shared EXPORT shared_set - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) + #install( + # TARGETS int-shared int-cxx-shared int-cxx-headeronly-shared #tgt::Eigen #libint-Eigen3 + # EXPORT local_set + # LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + # ) +# install( +# IMPORTED_RUNTIME_ARTIFACTS int-cxx-shared +# RUNTIME_DEPENDENCY_SET local_set +# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +# ) + else() install( - TARGETS int-shared int-cxx-shared int-cxx-headeronly-shared #tgt::Eigen #libint-Eigen3 - EXPORT local_set - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + TARGETS + int-shared + EXPORT shared_set + RUNTIME + COMPONENT ${L2}_RunTime + LIBRARY + COMPONENT ${L2}_RunTime + NAMELINK_COMPONENT ${L2}_Development + ARCHIVE + COMPONENT ${L2}_Development + PUBLIC_HEADER + COMPONENT ${L2}_Development ) - else() +# install( +# EXPORT shared_set +# DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} +# NAMESPACE "${L2}::" +# FILE ${L2}-Targets-shared.cmake +# COMPONENT ${L2}_Development +# ) + install( TARGETS int-shared EXPORT shared_set @@ -520,12 +550,12 @@ if (BUILD_STATIC_LIBS) EXPORT static_set ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) - install( - TARGETS int-static int-cxx-static int-cxx-headeronly-static #tgt::Eigen #libint-Eigen3 - EXPORT local_set - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT Eigen3 - ) + #install( + # TARGETS int-static int-cxx-static int-cxx-headeronly-static #tgt::Eigen #libint-Eigen3 + # EXPORT local_set + # ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + # COMPONENT Eigen3 + # ) else() install( TARGETS int-static @@ -585,12 +615,12 @@ if (BUILD_STATIC_LIBS) ) endif() -if (EXPORT_LOCAL_TARGETS) - install( - EXPORT local_set - FILE "${pnv}-targets-local.cmake" - NAMESPACE "${L2}::" - DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} - ) -endif() +#if (EXPORT_LOCAL_TARGETS) +# install( +# EXPORT local_set +# FILE "${pnv}-targets-local.cmake" +# NAMESPACE "${L2}::" +# DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} +# ) +#endif() From 1574ad2dd281e2272e87d08bae24c613f3900dd4 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 21 Jan 2022 17:32:27 -0500 Subject: [PATCH 044/182] help pkgconfig file paths --- cmake/libint2.pc.cmake.in | 4 ++-- cmake/modules/JoinPaths.cmake | 23 +++++++++++++++++++++++ src/lib/libint/CMakeLists.txt.export | 4 ++++ src/lib/libint/populate.cmake | 1 + 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 cmake/modules/JoinPaths.cmake 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/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/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 0685c7680..fcc72352e 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -589,6 +589,10 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config-version.cmake DESTINATION ${LIBINT2_INSTALL_CMAKEDIR}) +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/) diff --git a/src/lib/libint/populate.cmake b/src/lib/libint/populate.cmake index e29f2a914..fadcb52dd 100644 --- a/src/lib/libint/populate.cmake +++ b/src/lib/libint/populate.cmake @@ -53,6 +53,7 @@ file(INSTALL "${PROJECT_SOURCE_DIR}/cmake/modules/autocmake_safeguards.cmake" "${PROJECT_SOURCE_DIR}/cmake/modules/FindMPFR.cmake" "${PROJECT_SOURCE_DIR}/cmake/modules/AddCustomTargetSubproject.cmake" "${PROJECT_SOURCE_DIR}/cmake/modules/FindTargetEigen3.cmake" + "${PROJECT_SOURCE_DIR}/cmake/modules/JoinPaths.cmake" "${PROJECT_BINARY_DIR}/cmake/modules/int_computed.cmake" DESTINATION "${EXPORT_STAGE_DIR}/cmake/modules") From bd81d66301383acb0ebf95bcd64f4406e39135af Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 21 Jan 2022 23:27:54 -0500 Subject: [PATCH 045/182] work on aliases --- INSTALL.md | 3 ++- src/lib/libint/CMakeLists.txt.export | 37 +++++++++++++--------------- src/lib/libint/tests/CMakeLists.txt | 12 ++++----- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 7ae2614e6..126fc902c 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -223,8 +223,9 @@ These are the most useful configure options: * `--prefix=path` --> `-D CMAKE_INSTALL_PREFIX=path` (standard CMake variable) * Targets + * All targets listed below are available. rhs of arrow targets (namespaced with `Libint2::`) are preferred. lhs of arrow targets have legacy aliases for now. + * Namespaced targets available through `find_package()` or `add_subdirectory()` * `libint2` --> `Libint2::int2` (internal target name `int-{shared,static}`) * `libint2_cxx` --> `Libint2::cxx` (internal target name `int-cxx-headeronly-{shared,static}`) * DNE --> `Libint2::int2-cxx` (internal target name `int-cxx-{shared,static}`) - diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index fcc72352e..1629829cc 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -373,38 +373,35 @@ if (BUILD_STATIC_LIBS) endif(REQUIRE_CXX_API) 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-headeronly-shared) - add_library (int-cxx-headeronly-library ALIAS int-cxx-headeronly-shared) - endif() - if (TARGET int-cxx-shared) - add_library (int-cxx-library ALIAS int-cxx-shared) + add_library (${L2}::int2 ALIAS int-shared) + if (REQUIRE_CXX_API) + add_library (${L2}::cxx ALIAS int-cxx-headeronly-shared) + add_library (${L2}::int2-cxx ALIAS int-cxx-shared) endif() elseif (BUILD_STATIC_LIBS) - add_library (int-library ALIAS int-static) - if (TARGET int-cxx-headeronly-static) - add_library (int-cxx-headeronly-library ALIAS int-cxx-headeronly-static) - endif() - if (TARGET int-cxx-static) - add_library (int-cxx-library ALIAS int-cxx-static) + add_library (${L2}::int2 ALIAS int-static) + if (REQUIRE_CXX_API) + add_library (${L2}::cxx ALIAS int-cxx-headeronly-static) + add_library (${L2}::int2-cxx ALIAS int-cxx-static) 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) + 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) + if (REQUIRE_CXX_API) + add_library (libint2_cxx ALIAS int-cxx-headeronly-static) endif() endif() diff --git a/src/lib/libint/tests/CMakeLists.txt b/src/lib/libint/tests/CMakeLists.txt index 067b231e9..6f924f8cb 100644 --- a/src/lib/libint/tests/CMakeLists.txt +++ b/src/lib/libint/tests/CMakeLists.txt @@ -2,7 +2,7 @@ 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) @@ -49,7 +49,7 @@ if (LIBINT_HAS_CXX_API) endif(CMAKE_C_COMPILER) 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) @@ -65,7 +65,7 @@ if (LIBINT_HAS_CXX_API) 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) @@ -90,7 +90,7 @@ if (LIBINT_HAS_CXX_API) 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) @@ -119,7 +119,7 @@ if (ENABLE_FORTRAN) # tests add_executable(fortran_example-libint2 EXCLUDE_FROM_ALL fortran/fortran_example.F90) - target_link_libraries(fortran_example-libint2 libint2 libint_f) + target_link_libraries(fortran_example-libint2 Libint2::int2 libint_f) target_include_directories(fortran_example-libint2 PRIVATE $) target_compile_definitions(fortran_example-libint2 PRIVATE -D__COMPILING_LIBINT2=1) @@ -132,7 +132,7 @@ 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_link_libraries(fortran_test-libint2 Libint2::cxx libint_f) target_include_directories(fortran_test-libint2 PRIVATE $) target_compile_definitions(fortran_test-libint2 PRIVATE -D__COMPILING_LIBINT2=1) From cc13041fcab063d2a30c5cccb3aa5fcae58bb7d9 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Mon, 24 Jan 2022 15:24:51 -0500 Subject: [PATCH 046/182] test BUILD_TESTING. simplify for newer cmake version --- CMakeLists.txt | 10 ++++------ INSTALL.md | 9 +++++---- src/lib/libint/CMakeLists.txt | 2 +- src/lib/libint/CMakeLists.txt.export | 6 +++++- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index caf1e8aa3..9da207ed8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,7 @@ set(pnv libint2) # projectnameversion ################################### Options #################################### include(options) include(GNUInstallDirs) -include(CTest) # defines BUILD_TESTING option +include(CTest) message(STATUS "Building using CMake ${CMAKE_VERSION}") # <<< General >>> @@ -209,6 +209,8 @@ option_with_print(LIBINT_ENABLE_GENERIC_CODE 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) +# next one defined by `include(CTest)` +message(STATUS "Showing option BUILD_TESTING: ${BUILD_TESTING}") # <<< Path >>> @@ -216,6 +218,7 @@ option_with_default(BUILD_FPIC "Compile lone static library with position indepe # * 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}") @@ -302,10 +305,6 @@ booleanize01(LIBINT_ENABLE_GENERIC_CODE) 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() - 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) @@ -319,7 +318,6 @@ add_subdirectory(src) # <<< Test >>> if (BUILD_TESTING) - enable_testing(true) add_subdirectory(tests) endif() diff --git a/INSTALL.md b/INSTALL.md index 126fc902c..e26855c61 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -163,13 +163,14 @@ These are the most useful configure options: * Notes * Approximate defaults are shown. Actual defaults from [GNUInstallDirs](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html) -* `CMAKE_INSTALL_BINDIR` — L — Directory to which executables and runtime libraries are installed. [Default=bin] -* `CMAKE_INSTALL_LIBDIR` — L — Directory to which libraries are installed. [Default=lib] -* `CMAKE_INSTALL_INCLUDEDIR` — L — Directory to which headers are installed. [Default=include] -* `CMAKE_INSTALL_DATADIR` — L — Directory to which data files are installed. [Default=share] +* `CMAKE_INSTALL_BINDIR` — L — Directory to which executables and runtime libraries are installed. Standard CMake variable. [Default=bin] +* `CMAKE_INSTALL_LIBDIR` — L — Directory to which libraries are installed. Standard CMake variable. [Default=lib] +* `CMAKE_INSTALL_INCLUDEDIR` — L — Directory to which headers are installed. Standard CMake variable. [Default=include] +* `CMAKE_INSTALL_DATADIR` — L — Directory to which data files are installed. Standard CMake variable. [Default=share] * `LIBINT2_INSTALL_CMAKEDIR` — L — Directory to which CMake files are installed. [Default=lib/cmake/libint2] * `LIBINT2_INSTALL_BASISDIR` — L — Directory to which data (basis) files are installed. basis/ directory created within this. [Default=share/libint/] +* `BUILD_TESTING` — GL — Whether to build the testing infrastructure and define the `check` target. Standard CMake variable. [Default=ON] ## Autotools Update Guide diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index 58554d9b6..884c065e5 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -133,7 +133,7 @@ else() 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/" diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 1629829cc..87b5833cf 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -29,6 +29,7 @@ set(pnv libint2) # projectnameversion ################################### Options #################################### include(GNUInstallDirs) +include(CTest) include(options) # <<< General >>> @@ -36,7 +37,6 @@ include(options) 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 and Python)" 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(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) @@ -71,11 +71,15 @@ message(STATUS "Setting option LIBINT2_SHELL_SET: ${LIBINT2_SHELL_SET} (read-onl # <<< Miscellaneous >>> +# 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}") From 8893070c930dba6696c3dd4db9bf03fe0bd378b8 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 25 Jan 2022 01:12:48 -0500 Subject: [PATCH 047/182] onebody and pure_sh components for psi --- cmake/libint2-config.cmake.in | 10 ++++++++++ cmake/modules/int_am.cmake | 9 +++++---- cmake/modules/int_computed.cmake.in | 4 +++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index 167df0818..1814fd8a2 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -25,6 +25,8 @@ # 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) # +# 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 @@ -53,6 +55,7 @@ # CXX - search for at least Libint2::int2-cxx target # Fortran - search for at least libint_f target (NYI) # +# # Exported targets: # # :: @@ -117,6 +120,12 @@ foreach(_eri @Libint2_ERI_COMPONENTS@) set(${L2}_${_eri}_FOUND 1) endforeach() +# check pure restriction component +if((@ERI3_PURE_SH@ EQUAL 0) AND (@ERI2_PURE_SH@ EQUAL 0)) + set(${L2}_impure_sh_FOUND 1) +endif() +list(FIND ${L2}_FIND_COMPONENTS "impure_sh" _seek_impure_sh) + # check orderings component if ((@LIBINT_SHGSHELL_ORDERING@ EQUAL 1) AND (@LIBINT_CGSHELL_ORDERING@ EQUAL 1) AND (@LIBINT_SHELL_SET@ EQUAL 1)) set(_ordering "sss") @@ -187,6 +196,7 @@ endfunction() if(NOT CMAKE_REQUIRED_QUIET) + 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() diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index 8ee71e27c..7959d9a3d 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -8,10 +8,9 @@ # 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 twobody_c4_d1_l5)` +# `find_package(Libint2 COMPONENTS eri_c4_d1_l5)` -message(STATUS "LAB int.am") message(STATUS "Processing integrals classes ...") # <<< overall derivatives level >>> @@ -243,15 +242,17 @@ process_integrals_class(ERI2) process_integrals_class(G12) process_integrals_class(G12DKH) -# form list of active _ strings to use in Libint2Config +# form list of active class + deriv + max_am strings to use in Libint2Config set(Libint2_ERI_COMPONENTS "") -foreach(_cls ERI;ERI3;ERI2) +foreach(_cls ERI;ERI3;ERI2;ONEBODY) 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") endif() if (INCLUDE_${_cls} GREATER -1) diff --git a/cmake/modules/int_computed.cmake.in b/cmake/modules/int_computed.cmake.in index 73d8644f4..c59492914 100644 --- a/cmake/modules/int_computed.cmake.in +++ b/cmake/modules/int_computed.cmake.in @@ -35,10 +35,12 @@ message(STATUS "SO Version: Full ${LIBINT_SOVERSION} Major ${LIBINT_MAJOR_SOVERS 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_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 From e2709e3b4b8f99bd5c823303b01543dc267e7679 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 25 Jan 2022 02:22:08 -0500 Subject: [PATCH 048/182] cmake for doxygen. standardize some spacing --- CMakeLists.txt | 2 ++ doc/CMakeLists.txt | 1 + doc/classdoc/CMakeLists.txt | 20 ++++++++++++++++ src/lib/libint/CMakeLists.txt.export | 36 ++++++++++++++-------------- 4 files changed, 41 insertions(+), 18 deletions(-) create mode 100644 doc/CMakeLists.txt create mode 100644 doc/classdoc/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 9da207ed8..cd8037455 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -315,6 +315,8 @@ configure_file(include/libint2/config2.h.cmake.in ${EXPORT_STAGE_DIR}/include/li # compiler add_subdirectory(src) +add_subdirectory(doc) + # <<< Test >>> if (BUILD_TESTING) 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/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 87b5833cf..0f7fb86eb 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -255,9 +255,9 @@ if (REQUIRE_CXX_API) ${PROJECT_BINARY_DIR}/include/libint2/ ) - target_link_libraries (int-cxx-obj PRIVATE tgt::Eigen) + target_link_libraries(int-cxx-obj PRIVATE tgt::Eigen) if (TARGET Boost::headers) - target_link_libraries (int-cxx-obj PRIVATE Boost::headers) + target_link_libraries(int-cxx-obj PRIVATE Boost::headers) endif() endif() @@ -298,11 +298,11 @@ if (BUILD_SHARED_LIBS) target_compile_features(int-cxx-headeronly-shared INTERFACE "cxx_std_11") - set_target_properties (int-cxx-headeronly-shared PROPERTIES EXPORT_NAME "cxx") + set_target_properties(int-cxx-headeronly-shared PROPERTIES EXPORT_NAME "cxx") - target_link_libraries (int-cxx-headeronly-shared INTERFACE int-shared tgt::Eigen) + target_link_libraries(int-cxx-headeronly-shared INTERFACE int-shared tgt::Eigen) if (TARGET Boost::headers) - target_link_libraries (int-cxx-headeronly-shared INTERFACE Boost::headers) + target_link_libraries(int-cxx-headeronly-shared INTERFACE Boost::headers) endif() # now make the compiled library @@ -356,11 +356,11 @@ if (BUILD_STATIC_LIBS) target_compile_features(int-cxx-headeronly-static INTERFACE "cxx_std_11") - set_target_properties (int-cxx-headeronly-static PROPERTIES EXPORT_NAME "cxx") + set_target_properties(int-cxx-headeronly-static PROPERTIES EXPORT_NAME "cxx") - target_link_libraries (int-cxx-headeronly-static INTERFACE int-static tgt::Eigen) + target_link_libraries(int-cxx-headeronly-static INTERFACE int-static tgt::Eigen) if (TARGET Boost::headers) - target_link_libraries (int-cxx-headeronly-static INTERFACE Boost::headers) + target_link_libraries(int-cxx-headeronly-static INTERFACE Boost::headers) endif() # now make the compiled library @@ -382,30 +382,30 @@ endif() # * used for tests if (BUILD_SHARED_LIBS) - add_library (${L2}::int2 ALIAS int-shared) + add_library(${L2}::int2 ALIAS int-shared) if (REQUIRE_CXX_API) - add_library (${L2}::cxx ALIAS int-cxx-headeronly-shared) - add_library (${L2}::int2-cxx ALIAS int-cxx-shared) + add_library(${L2}::cxx ALIAS int-cxx-headeronly-shared) + add_library(${L2}::int2-cxx ALIAS int-cxx-shared) endif() elseif (BUILD_STATIC_LIBS) - add_library (${L2}::int2 ALIAS int-static) + add_library(${L2}::int2 ALIAS int-static) if (REQUIRE_CXX_API) - add_library (${L2}::cxx ALIAS int-cxx-headeronly-static) - add_library (${L2}::int2-cxx ALIAS int-cxx-static) + add_library(${L2}::cxx ALIAS int-cxx-headeronly-static) + add_library(${L2}::int2-cxx ALIAS int-cxx-static) endif() endif() # Legacy (pre-2.7.0) aliases =========================================================================================== if (BUILD_SHARED_LIBS) - add_library (libint2 ALIAS int-shared) + add_library(libint2 ALIAS int-shared) if (REQUIRE_CXX_API) - add_library (libint2_cxx ALIAS int-cxx-headeronly-shared) + add_library(libint2_cxx ALIAS int-cxx-headeronly-shared) endif() elseif (BUILD_STATIC_LIBS) - add_library (libint2 ALIAS int-static) + add_library(libint2 ALIAS int-static) if (REQUIRE_CXX_API) - add_library (libint2_cxx ALIAS int-cxx-headeronly-static) + add_library(libint2_cxx ALIAS int-cxx-headeronly-static) endif() endif() From f242c015a948ea99d325328adb8cefa678e642a0 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 25 Jan 2022 02:34:28 -0500 Subject: [PATCH 049/182] add install component to library installs --- src/lib/libint/CMakeLists.txt.export | 172 +++++++++++++++++---------- 1 file changed, 109 insertions(+), 63 deletions(-) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 0f7fb86eb..86bcfc935 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -282,7 +282,6 @@ if (BUILD_SHARED_LIBS) $ $ $ - $ ) # C++ library @@ -340,7 +339,6 @@ if (BUILD_STATIC_LIBS) $ $ $ - $ ) # C++ library @@ -478,31 +476,48 @@ endif() # <<< Install >>> -install(DIRECTORY ${PROJECT_BINARY_DIR}/include/ - ${PROJECT_SOURCE_DIR}/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - FILES_MATCHING PATTERN "*.h" - PATTERN "*.hpp") +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) +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 + ) #target_include_directories(int-obj PRIVATE ${PROJECT_BINARY_DIR}) if (BUILD_SHARED_LIBS) if (TARGET int-cxx-headeronly-shared AND TARGET int-cxx-shared) - install( - TARGETS - int-shared - int-cxx-shared - int-cxx-headeronly-shared - #TARGETS int-shared int-cxx-headeronly-shared - EXPORT shared_set -# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) + install( + TARGETS + int-shared + int-cxx-shared + int-cxx-headeronly-shared + 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} + ) #install( # TARGETS int-shared int-cxx-shared int-cxx-headeronly-shared #tgt::Eigen #libint-Eigen3 # EXPORT local_set @@ -514,20 +529,21 @@ if (BUILD_SHARED_LIBS) # LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # ) else() - install( - TARGETS - int-shared - EXPORT shared_set - RUNTIME - COMPONENT ${L2}_RunTime - LIBRARY - COMPONENT ${L2}_RunTime - NAMELINK_COMPONENT ${L2}_Development - ARCHIVE - COMPONENT ${L2}_Development - PUBLIC_HEADER - COMPONENT ${L2}_Development - ) + install( + TARGETS + int-shared + 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} + ) # install( # EXPORT shared_set # DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} @@ -536,21 +552,33 @@ if (BUILD_SHARED_LIBS) # COMPONENT ${L2}_Development # ) - install( - TARGETS int-shared - EXPORT shared_set - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) +# install( +# TARGETS int-shared +# EXPORT shared_set +# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +# ) endif() endif() if (BUILD_STATIC_LIBS) if (TARGET int-cxx-headeronly-static AND TARGET int-cxx-static) - install( - TARGETS int-static int-cxx-static int-cxx-headeronly-static - EXPORT static_set - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) + install( + TARGETS + int-static + int-cxx-static + int-cxx-headeronly-static + 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} + ) #install( # TARGETS int-static int-cxx-static int-cxx-headeronly-static #tgt::Eigen #libint-Eigen3 # EXPORT local_set @@ -558,11 +586,21 @@ if (BUILD_STATIC_LIBS) # COMPONENT Eigen3 # ) else() - install( - TARGETS int-static - EXPORT static_set - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) + install( + TARGETS + int-static + 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() endif() @@ -570,37 +608,43 @@ endif() 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 ${LIBINT2_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 ${LIBINT2_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/FindTargetEigen3.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/) install( - FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/FindTargetEigen3.cmake - DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} - ) + FILES ${CMAKE_CURRENT_BINARY_DIR}/libint2.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ + COMPONENT ${L2}_Development + ) if (BUILD_SHARED_LIBS) install( @@ -608,6 +652,7 @@ if (BUILD_SHARED_LIBS) FILE "${pnv}-targets-shared.cmake" NAMESPACE "${L2}::" DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} + COMPONENT ${L2}_Development ) endif() @@ -617,6 +662,7 @@ if (BUILD_STATIC_LIBS) FILE "${pnv}-targets-static.cmake" NAMESPACE "${L2}::" DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} + COMPONENT ${L2}_Development ) endif() From 14118c776d99ed2fb63186c873dbabb00ffe83ba Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 25 Jan 2022 02:35:09 -0500 Subject: [PATCH 050/182] tidy config file. more docs. --- INSTALL.md | 68 +++++++++++++++++++++++++++++++++++ cmake/libint2-config.cmake.in | 13 +++++-- 2 files changed, 79 insertions(+), 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index e26855c61..f0120886e 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -230,3 +230,71 @@ These are the most useful configure options: * `libint2_cxx` --> `Libint2::cxx` (internal target name `int-cxx-headeronly-{shared,static}`) * DNE --> `Libint2::int2-cxx` (internal target name `int-cxx-{shared,static}`) + + +## 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: + + ``` + -DREQUIRE_CXX_API=ON -DLIBINT2_SHGAUSS_ORDERING=gaussian -DLIBINT2_CARTGAUSS_ORDERING=standard -DLIBINT2_SHELL_SET=standard -DENABLE_ERI=2 -DENABLE_ERI3=2 -DENABLE_ERI2=2 -DENABLE_ONEBODY=2 -DMULTIPOLE_MAX_ORDER=4 -DWITH_MAX_AM="6;5;4" -DWITH_ERI_MAX_AM="5;4;3" -DWITH_ERI3_MAX_AM="6;5;4" -DWITH_ERI2_MAX_AM="6;5;4" -DERI3_PURE_SH=OFF -DERI2_PURE_SH=OFF + ``` + +* minimal detection: + + ``` + find_package(Libint2 COMPONENTS gss CXX_ho impure_sh eri_c4_d0_l3 eri_c4_d1_l2 eri_c4_d2_l2 eri_c3_d0_l4 eri_c3_d1_l3 eri_c3_d2_l3 eri_c2_d0_l4 eri_c2_d1_l3 eri_c2_d2_l3 onebody_d0_l4 onebody_d1_l3 onebody_d2_l3) + ``` + +* see [notes](https://github.com/psi4/psi4/blob/master/external/upstream/libint2/CMakeLists.txt) for details of Psi4/Libint2 configuration + + -DDISABLE_ONEBODY_PROPERTY_DERIVS=OFF \ + -DENABLE_G12=1 \ + -DWITH_G12_MAX_AM=4 \ + -DWITH_G12_OPT_AM=3 \ + diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index 1814fd8a2..6f67d3f20 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -60,12 +60,19 @@ # # :: # -# 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 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: @@ -106,8 +113,10 @@ list(FIND ${L2}_FIND_COMPONENTS "static" _seek_static) set(${L2}_C_FOUND 1) list(FIND ${L2}_FIND_COMPONENTS "C" _seek_C) if(@REQUIRE_CXX_API@) + set(${L2}_CXX_ho_FOUND 1) set(${L2}_CXX_FOUND 1) endif() +list(FIND ${L2}_FIND_COMPONENTS "CXX_ho" _seek_CXX_ho) list(FIND ${L2}_FIND_COMPONENTS "CXX" _seek_CXX) if(@ENABLE_FORTRAN@) set(${L2}_Fortran_FOUND 1) From 8d988cd52edfc581ccdf7553881b39e011b50112 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 28 Jan 2022 16:05:18 -0500 Subject: [PATCH 051/182] start sorting out gmp and mpfr --- CMakeLists.txt | 1 + INSTALL.md | 3 + cmake/modules/FindMPFR.cmake | 139 ---------- cmake/modules/FindMultiprecision.cmake | 346 +++++++++++++++++++++++++ src/bin/libint/CMakeLists.txt | 16 +- src/lib/libint/CMakeLists.txt | 1 + src/lib/libint/CMakeLists.txt.export | 12 +- src/lib/libint/populate.cmake | 2 +- src/lib/libint/tests/CMakeLists.txt | 20 +- 9 files changed, 382 insertions(+), 158 deletions(-) delete mode 100644 cmake/modules/FindMPFR.cmake create mode 100644 cmake/modules/FindMultiprecision.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index cd8037455..31e03fbc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -209,6 +209,7 @@ option_with_print(LIBINT_ENABLE_GENERIC_CODE 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_print(ENABLE_MPFR "Use GNU MPFR library for high-precision testing (EXPERTS ONLY)" OFF) # next one defined by `include(CTest)` message(STATUS "Showing option BUILD_TESTING: ${BUILD_TESTING}") diff --git a/INSTALL.md b/INSTALL.md index f0120886e..c4bb1055b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -171,6 +171,7 @@ These are the most useful configure options: * `LIBINT2_INSTALL_BASISDIR` — L — Directory to which data (basis) files are installed. basis/ directory created within this. [Default=share/libint/] * `BUILD_TESTING` — GL — Whether to build the testing infrastructure and define the `check` target. Standard CMake variable. [Default=ON] +* `ENABLE_MPFR` — L — Use MPFR dependency to test Libint integrals in high precision. [Default=OFF] ## Autotools Update Guide @@ -221,6 +222,8 @@ These are the most useful configure options: * `--enable-shared --enable-static` --> `-D BUILD_SHARED=ON -D BUILD_STATIC=ON` --> `-D LIBINT2_BUILD_SHARED_AND_STATIC_LIBS=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) * Targets 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..bc73cb25f --- /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/src/bin/libint/CMakeLists.txt b/src/bin/libint/CMakeLists.txt index e9ed429f4..0d4cb813f 100644 --- a/src/bin/libint/CMakeLists.txt +++ b/src/bin/libint/CMakeLists.txt @@ -59,11 +59,17 @@ set_target_properties(libint-libcompiler PROPERTIES LIBRARY_OUTPUT_NAME int2-lib find_package(Boost 1.57 REQUIRED) target_link_libraries(libint-libcompiler PUBLIC Boost::headers) -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}") +find_package(Multiprecision MODULE REQUIRED COMPONENTS gmpxx) +target_link_libraries(libint-libcompiler PUBLIC Multiprecision::gmpxx) + +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/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index 884c065e5..66f9631b9 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -95,6 +95,7 @@ else() -DENABLE_FORTRAN=${ENABLE_FORTRAN} -DLIBINT2_SHGAUSS_ORDERING=${LIBINT2_SHGAUSS_ORDERING} -DBUILD_TESTING=${BUILD_TESTING} + -DENABLE_MPFR=${ENABLE_MPFR} ) if (CMAKE_C_COMPILER) list(APPEND library_CMAKE_ARGS diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 86bcfc935..201ceeee9 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -107,8 +107,15 @@ 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::headers) @@ -128,7 +135,6 @@ else() 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() ## look for Eigen diff --git a/src/lib/libint/populate.cmake b/src/lib/libint/populate.cmake index fadcb52dd..ca4d49fde 100644 --- a/src/lib/libint/populate.cmake +++ b/src/lib/libint/populate.cmake @@ -50,7 +50,7 @@ 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/FindTargetEigen3.cmake" "${PROJECT_SOURCE_DIR}/cmake/modules/JoinPaths.cmake" diff --git a/src/lib/libint/tests/CMakeLists.txt b/src/lib/libint/tests/CMakeLists.txt index 6f924f8cb..a8ee31a56 100644 --- a/src/lib/libint/tests/CMakeLists.txt +++ b/src/lib/libint/tests/CMakeLists.txt @@ -6,10 +6,10 @@ 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() 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) @@ -46,16 +46,16 @@ 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 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() 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) @@ -113,7 +113,7 @@ if (LIBINT_HAS_CXX_API) set_tests_properties(libint2/hf++/run PROPERTIES FIXTURES_REQUIRED LIBINT2_HFXXTEST_EXEC) -endif (LIBINT_HAS_CXX_API) +endif() if (ENABLE_FORTRAN) @@ -142,6 +142,6 @@ if (ENABLE_FORTRAN) 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() From 0b38bf33d77df87cf95b52ee20da38d2ce0f9beb Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 28 Jan 2022 16:26:50 -0500 Subject: [PATCH 052/182] more dependencies --- cmake/libint2-config.cmake.in | 54 +++--- cmake/modules/FindGMP.cmake | 139 -------------- src/lib/libint/CMakeLists.txt | 10 +- src/lib/libint/CMakeLists.txt.export | 267 ++++++++++++++------------- src/lib/libint/tests/CMakeLists.txt | 16 ++ 5 files changed, 181 insertions(+), 305 deletions(-) delete mode 100644 cmake/modules/FindGMP.cmake diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index 6f67d3f20..65e45fcae 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -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 # # @@ -99,6 +96,11 @@ set(pnv libint2) # projectnameversion set(L2 Libint2) # NameSpace +set(Libint2_EXT_VERSION @LIBINT_EXT_VERSION@) + +# make detectable the various cmake modules exported alongside +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + # check library style component if(@BUILD_SHARED_LIBS@) set(${L2}_shared_FOUND 1) @@ -110,9 +112,22 @@ 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@) + if(NOT TARGET tgt::Eigen) + find_dependency(TargetEigen3 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() + endif() + set(${L2}_CXX_ho_FOUND 1) set(${L2}_CXX_FOUND 1) endif() @@ -212,26 +227,11 @@ endif() check_required_components(${L2}) -# make detectable the various cmake modules exported alongside -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) - #----------------------------------------------------------------------------- # 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 ${L2}::int2) - include(CMakeFindDependencyMacro) - if(NOT TARGET tgt::Eigen) - find_dependency(TargetEigen3 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() - endif() - if(_seek_static GREATER -1) include("${CMAKE_CURRENT_LIST_DIR}/${pnv}-targets-static.cmake") elseif(_seek_shared GREATER -1) @@ -242,17 +242,11 @@ if(NOT TARGET ${L2}::int2) include("${CMAKE_CURRENT_LIST_DIR}/${pnv}-targets-static.cmake") endif() - get_property(_loc TARGET ${L2}::cxx PROPERTY LOCATION) - set(${L2}_LIBRARY ${_loc}) - get_property(_ill TARGET ${L2}::cxx PROPERTY INTERFACE_LINK_LIBRARIES) - set(${L2}_LIBRARIES ${_ill}) - - get_property(_id TARGET ${L2}::cxx PROPERTY INCLUDE_DIRECTORIES) - set(${L2}_INCLUDE_DIR ${_id}) - get_property(_iid TARGET ${L2}::cxx PROPERTY INTERFACE_INCLUDE_DIRECTORIES) - set(${L2}_INCLUDE_DIRS ${_iid}) - - message(DEBUG "Libint2::cxx") + 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}") 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/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index 66f9631b9..86b2b7e66 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -107,9 +107,9 @@ else() "-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}" ) endif() - if (CMAKE_PREFIX_PATH) + if (Eigen3_DIR) list(APPEND library_CMAKE_ARGS - "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" + "-DEigen3_DIR=${Eigen3_DIR}" ) endif() message(STATUS "invoking ExternalProject_add to build+test Libint library with library_CMAKE_ARGS=${library_CMAKE_ARGS}") @@ -122,8 +122,10 @@ else() # 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 diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 201ceeee9..ad3105823 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -105,7 +105,19 @@ if (MSVC) set(LIBINT2_ALIGN_SIZE "0" CACHE STRING "(LAB) I so don't understand the option handling of ALIGN_SIZE") endif() -# req'd for now (no FindGMP.cmake, though one at Elemental project) +# look for Eigen +find_package(TargetEigen3 MODULE) + +if (TARGET tgt::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() + if (ENABLE_MPFR) find_package(Multiprecision MODULE REQUIRED COMPONENTS gmpxx mpfr) @@ -117,23 +129,25 @@ if (ENABLE_MPFR) message(STATUS "${Cyan}Found MPFR${ColourReset}: ${_loc} (found version ${MPFR_VERSION})") endif() -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}") +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() @@ -171,17 +185,6 @@ endif() #if (TARGET libint-Eigen3) -find_package(TargetEigen3 MODULE) - -if (TARGET tgt::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() # Python is optional, unless ... if (ENABLE_FORTRAN) # ... need fortran @@ -237,34 +240,34 @@ endif() # if building CXX API, make an object lib needed for non-header-only version if (REQUIRE_CXX_API) - add_library(int-cxx-obj OBJECT src/engine.cpp) + 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_compile_definitions( + int-cxx-obj + PUBLIC + LIBINT2_DOES_NOT_INLINE_ENGINE=1 + __COMPILING_LIBINT2=1 + ) - target_compile_features(int-cxx-obj PUBLIC "cxx_std_11") + target_compile_features(int-cxx-obj PUBLIC "cxx_std_11") - if (BUILD_SHARED_LIBS) - set_target_properties(int-cxx-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) - endif() + if (BUILD_SHARED_LIBS) + set_target_properties(int-cxx-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) + endif() - target_include_directories( - int-cxx-obj - PRIVATE - ${PROJECT_BINARY_DIR}/include/ - ${PROJECT_SOURCE_DIR}/src/ - ${PROJECT_SOURCE_DIR}/include/ - ${PROJECT_BINARY_DIR}/include/libint2/ - ) - - target_link_libraries(int-cxx-obj PRIVATE tgt::Eigen) - if (TARGET Boost::headers) - target_link_libraries(int-cxx-obj PRIVATE Boost::headers) - endif() + target_include_directories( + int-cxx-obj + PRIVATE + ${PROJECT_BINARY_DIR}/include/ + ${PROJECT_SOURCE_DIR}/src/ + ${PROJECT_SOURCE_DIR}/include/ + ${PROJECT_BINARY_DIR}/include/libint2/ + ) + + target_link_libraries(int-cxx-obj PRIVATE tgt::Eigen) + if (TARGET Boost::headers) + target_link_libraries(int-cxx-obj PRIVATE Boost::headers) + endif() endif() if (BUILD_SHARED_LIBS) @@ -292,37 +295,37 @@ if (BUILD_SHARED_LIBS) # C++ library if (REQUIRE_CXX_API) - add_library(int-cxx-headeronly-shared INTERFACE) + add_library(int-cxx-headeronly-shared INTERFACE) - target_compile_definitions( - int-cxx-headeronly-shared - INTERFACE - $ - $ - ) + target_compile_definitions( + int-cxx-headeronly-shared + INTERFACE + $ + $ + ) - target_compile_features(int-cxx-headeronly-shared INTERFACE "cxx_std_11") + target_compile_features(int-cxx-headeronly-shared INTERFACE "cxx_std_11") - set_target_properties(int-cxx-headeronly-shared PROPERTIES EXPORT_NAME "cxx") + set_target_properties(int-cxx-headeronly-shared PROPERTIES EXPORT_NAME "cxx") - target_link_libraries(int-cxx-headeronly-shared INTERFACE int-shared tgt::Eigen) - if (TARGET Boost::headers) - target_link_libraries(int-cxx-headeronly-shared INTERFACE Boost::headers) - endif() + target_link_libraries(int-cxx-headeronly-shared INTERFACE int-shared tgt::Eigen) + if (TARGET Boost::headers) + target_link_libraries(int-cxx-headeronly-shared INTERFACE Boost::headers) + endif() - # now make the compiled library - add_library(int-cxx-shared SHARED $) + # 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" - ) + 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_link_libraries(int-cxx-shared INTERFACE int-cxx-headeronly-shared) endif() endif() @@ -349,35 +352,35 @@ if (BUILD_STATIC_LIBS) # C++ library if (REQUIRE_CXX_API) - add_library(int-cxx-headeronly-static INTERFACE) + add_library(int-cxx-headeronly-static INTERFACE) - target_compile_definitions( - int-cxx-headeronly-static - INTERFACE - $ - $ - ) + target_compile_definitions( + int-cxx-headeronly-static + INTERFACE + $ + $ + ) - target_compile_features(int-cxx-headeronly-static INTERFACE "cxx_std_11") + target_compile_features(int-cxx-headeronly-static INTERFACE "cxx_std_11") - set_target_properties(int-cxx-headeronly-static PROPERTIES EXPORT_NAME "cxx") + set_target_properties(int-cxx-headeronly-static PROPERTIES EXPORT_NAME "cxx") - target_link_libraries(int-cxx-headeronly-static INTERFACE int-static tgt::Eigen) - if (TARGET Boost::headers) - target_link_libraries(int-cxx-headeronly-static INTERFACE Boost::headers) - endif() + target_link_libraries(int-cxx-headeronly-static INTERFACE int-static tgt::Eigen) + if (TARGET Boost::headers) + target_link_libraries(int-cxx-headeronly-static INTERFACE Boost::headers) + endif() - # now make the compiled library - add_library(int-cxx-static STATIC $) + # 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" - ) + 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) + target_link_libraries(int-cxx-static INTERFACE int-cxx-headeronly-static) endif(REQUIRE_CXX_API) endif() @@ -483,25 +486,25 @@ endif() # <<< Install >>> install( - DIRECTORY - ${PROJECT_BINARY_DIR}/include/ - ${PROJECT_SOURCE_DIR}/include/ - TYPE INCLUDE - COMPONENT ${L2}_Development - FILES_MATCHING - PATTERN "*.h" - PATTERN "*.hpp" - ) + 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 - ) + 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 + ) #target_include_directories(int-obj PRIVATE ${PROJECT_BINARY_DIR}) @@ -624,22 +627,22 @@ endif() # <<< Export Config >>> 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 - ) + 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 - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/FindTargetEigen3.cmake - DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} - COMPONENT ${L2}_Development - ) + FILES + ${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config-version.cmake + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/FindTargetEigen3.cmake + DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} + COMPONENT ${L2}_Development + ) include(JoinPaths) join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}") @@ -647,10 +650,10 @@ 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/ - COMPONENT ${L2}_Development - ) + FILES ${CMAKE_CURRENT_BINARY_DIR}/libint2.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ + COMPONENT ${L2}_Development + ) if (BUILD_SHARED_LIBS) install( diff --git a/src/lib/libint/tests/CMakeLists.txt b/src/lib/libint/tests/CMakeLists.txt index a8ee31a56..6885d7df1 100644 --- a/src/lib/libint/tests/CMakeLists.txt +++ b/src/lib/libint/tests/CMakeLists.txt @@ -11,16 +11,20 @@ if (TARGET Multiprecision::mpfr) 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 @@ -57,8 +61,10 @@ if (LIBINT_HAS_CXX_API) 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 @@ -69,9 +75,11 @@ if (LIBINT_HAS_CXX_API) 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 (Python_Interpreter_FOUND) + # Test 8 add_test(NAME libint2/hf/run COMMAND ${CMAKE_COMMAND} -DexecName=hf-libint2 @@ -82,6 +90,7 @@ if (LIBINT_HAS_CXX_API) -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) endif() @@ -94,9 +103,11 @@ if (LIBINT_HAS_CXX_API) 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 (Python_Interpreter_FOUND) + # Test 10 add_test(NAME libint2/hf++/run COMMAND ${CMAKE_COMMAND} -DexecName=hf++-libint2 @@ -107,6 +118,7 @@ if (LIBINT_HAS_CXX_API) -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() @@ -123,8 +135,10 @@ if (ENABLE_FORTRAN) target_include_directories(fortran_example-libint2 PRIVATE $) 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 @@ -136,8 +150,10 @@ if (ENABLE_FORTRAN) target_include_directories(fortran_test-libint2 PRIVATE $) 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 From 7d8e49f65e3654a8626e0b5532fb725ea79e38de Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 28 Jan 2022 16:33:13 -0500 Subject: [PATCH 053/182] don't disable system gmp --- INSTALL.md | 64 +++++++++++++++++++++++++- cmake/modules/FindMultiprecision.cmake | 12 ++--- 2 files changed, 69 insertions(+), 7 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index c4bb1055b..ddec52b96 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -12,6 +12,68 @@ Before you read on: +# Prerequisites + + boost eigen gmpxx mpfr +build_libint * - * - +gen test +library::int2 (.tgz) - - - +Libint2::cxx_ho .tgz * - - +Libint2::cxx_ho ENABLE_MPFR=ON .tgz * * * +Libint2::cxx + +interface Libint2::cxx_ho (*) * - - + +TODO straighten out target names, e.g., Libint2::cxx_ho and Libint2::cxx vs cxx and int-cxx +lib with ENABLE_MPFR/LIBINT_HAS_MPFR needs gmpxx and mpfr +(.tgz) unpacked if eigen found and system boost not found + +| | C O M | P I L | E R S | +| | C++[^1] | Fortran[^2] | C | CMake[^3] | CMake generator | Boost[^7] | Eigen | GMPXX MPFR +| -------- | ------- | ----------- | -------- | --------- | --------------- | --------- | ------ | -- +| build target `build_libint` | * | - | - | *[^4] | Ninja | *[^8] | - | * - +| build target `library` | * | - | - | *[^5] | Ninja | - | - | - - +| `-D REQUIRE_CXX_API=ON` | * | - | - | *[^5] | Ninja | (*)[^9] | *[^11] | - - +| `-D ENABLE_FORTRAN=ON` | * | * | * | *[^5] | Ninja | - | - | +| build project linking C interface, `Libint2::int2` | * or C | - | * or C++ | (*)[^6] | Ninja, Makefile | - | - | - - +| build project linking C++11 header-only interface, `Libint2::cxx_ho` | * | - | - | (*)[^6] | Ninja, Makefile | (*)[^10] | * | - - +| `-D ENABLE_MPFR=ON` | * | - | - | (*)[^6] | Ninja, Makefile | (*)[^10] | * | * * +| build project linking C++11 interface, `Libint2::cxx` | * | - | - | (*)[^6] | Ninja, Makefile | (*)[^10] | *[^12] | +| build project linking Fortran interface, `Libint2::fortran` | | * | | (*)[^6] | Ninja, Makefile | | | + +* `*` required +* `-` not involved +* `(*)` recommended or sought, but there's a path forward without + +(*) required to set up dependency for header-only interface, but not used until QC + +Boost: CMAKE_PREFIX_PATH BOOST_ROOT + +[^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 + +[^3] CMake 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 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::cxx`, the PP is actually compiled against, but for the header-only target, 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 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::cxx` requires Eigen. It is *strongly* recommended that the same installation of Eigen be used both to build and consume the `Libint2::cxx` target, especially as regards configuring BLAS and other backends. + + # Synopsis - configure: `cmake -S /path/to/compiler/source/tree -B build [-Dvar1=value1] [-Dvar2=value2] ...` where @@ -173,7 +235,7 @@ These are the most useful configure options: * `BUILD_TESTING` — GL — Whether to build the testing infrastructure and define the `check` target. Standard CMake variable. [Default=ON] * `ENABLE_MPFR` — L — Use MPFR dependency to test Libint integrals in high precision. [Default=OFF] -## Autotools Update Guide +## 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 diff --git a/cmake/modules/FindMultiprecision.cmake b/cmake/modules/FindMultiprecision.cmake index bc73cb25f..d7c2e98c9 100644 --- a/cmake/modules/FindMultiprecision.cmake +++ b/cmake/modules/FindMultiprecision.cmake @@ -89,8 +89,8 @@ find_path( $ENV{GMPDIR} $ENV{MPFRDIR} ${INCLUDE_INSTALL_DIR} - NO_SYSTEM_ENVIRONMENT_PATH - NO_CMAKE_SYSTEM_PATH + #NO_SYSTEM_ENVIRONMENT_PATH + #NO_CMAKE_SYSTEM_PATH ) # Set MPFR_FIND_VERSION to 1.0.0 if no minimum version is specified @@ -158,8 +158,8 @@ find_path( $ENV{GMPDIR} $ENV{MPFRDIR} ${INCLUDE_INSTALL_DIR} - NO_SYSTEM_ENVIRONMENT_PATH - NO_CMAKE_SYSTEM_PATH + #NO_SYSTEM_ENVIRONMENT_PATH + #NO_CMAKE_SYSTEM_PATH ) find_library( @@ -183,8 +183,8 @@ find_path( $ENV{GMPDIR} $ENV{MPFRDIR} ${INCLUDE_INSTALL_DIR} - NO_SYSTEM_ENVIRONMENT_PATH - NO_CMAKE_SYSTEM_PATH + #NO_SYSTEM_ENVIRONMENT_PATH + #NO_CMAKE_SYSTEM_PATH ) find_library( From 9dc3da5a91635a96badf4e4816e37372502cfebd Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 28 Jan 2022 22:19:47 -0500 Subject: [PATCH 054/182] Update INSTALL.md --- INSTALL.md | 66 +++++++++++++++++++++++------------------------------- 1 file changed, 28 insertions(+), 38 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index ddec52b96..c06189d8c 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -14,64 +14,54 @@ Before you read on: # Prerequisites - boost eigen gmpxx mpfr -build_libint * - * - -gen test -library::int2 (.tgz) - - - -Libint2::cxx_ho .tgz * - - -Libint2::cxx_ho ENABLE_MPFR=ON .tgz * * * -Libint2::cxx - -interface Libint2::cxx_ho (*) * - - - TODO straighten out target names, e.g., Libint2::cxx_ho and Libint2::cxx vs cxx and int-cxx lib with ENABLE_MPFR/LIBINT_HAS_MPFR needs gmpxx and mpfr (.tgz) unpacked if eigen found and system boost not found -| | C O M | P I L | E R S | -| | C++[^1] | Fortran[^2] | C | CMake[^3] | CMake generator | Boost[^7] | Eigen | GMPXX MPFR -| -------- | ------- | ----------- | -------- | --------- | --------------- | --------- | ------ | -- -| build target `build_libint` | * | - | - | *[^4] | Ninja | *[^8] | - | * - -| build target `library` | * | - | - | *[^5] | Ninja | - | - | - - -| `-D REQUIRE_CXX_API=ON` | * | - | - | *[^5] | Ninja | (*)[^9] | *[^11] | - - -| `-D ENABLE_FORTRAN=ON` | * | * | * | *[^5] | Ninja | - | - | -| build project linking C interface, `Libint2::int2` | * or C | - | * or C++ | (*)[^6] | Ninja, Makefile | - | - | - - -| build project linking C++11 header-only interface, `Libint2::cxx_ho` | * | - | - | (*)[^6] | Ninja, Makefile | (*)[^10] | * | - - -| `-D ENABLE_MPFR=ON` | * | - | - | (*)[^6] | Ninja, Makefile | (*)[^10] | * | * * -| build project linking C++11 interface, `Libint2::cxx` | * | - | - | (*)[^6] | Ninja, Makefile | (*)[^10] | *[^12] | -| build project linking Fortran interface, `Libint2::fortran` | | * | | (*)[^6] | Ninja, Makefile | | | - -* `*` required -* `-` not involved -* `(*)` recommended or sought, but there's a path forward without +| Task | Compilers | CMake[^3] | CMake generator | Boost[^7] | Eigen | GMPXX[^13] | MPFR[^19] | +| -------------------------------------------------------------------- | :---------------------: | :-------: | --------------- | :-------: | :----: | :--------: | :-------: | +| build target `build_libint` | C++[^1] | 🔵[^4] | Ninja | 🔵[^8] | – | 🔵 | – | +| build target `library` | C++[^1] | 🔵[^5] | Ninja | – | – | – | – | +|   `-D REQUIRE_CXX_API=ON` | C++[^1] | 🔵[^5] | Ninja | 🔸[^9] | 🔵[^11] | – | – | +|   `-D ENABLE_FORTRAN=ON` | C++[^1], Fortran[^2], C | 🔵[^5] | Ninja | – | – | – | – | +| build project linking C interface, `Libint2::int2` | C++[^1] | 🔸[^6] | Ninja, Makefile | – | – | – | – | +| build project linking C++11 header-only interface, `Libint2::cxx_ho` | C++[^1] | 🔸[^6] | Ninja, Makefile | 🔸[^10] | 🔵 | – | – | +|   `-D ENABLE_MPFR=ON` | C++[^1] | 🔸[^6] | Ninja, Makefile | 🔸[^10] | 🔵 | 🔵 | 🔵 | +| build project linking C++11 interface, `Libint2::cxx` | C++[^1] | 🔸[^6] | Ninja, Makefile | 🔸[^10] | 🔵[^12] | – | – | +| build project linking Fortran interface, `Libint2::fortran` | Fortran[^2] | 🔸[^6] | Ninja, Makefile | | | – | – | + +* `🔵` required +* `🔸` required or recommended, but there's a path forward without +* `—` not involved + (*) required to set up dependency for header-only interface, but not used until QC Boost: CMAKE_PREFIX_PATH BOOST_ROOT -[^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. +[^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 +[^2]: Fortran 2003 compiler. -[^3] CMake 3.16 or higher. +[^3]: CMake 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). +[^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). +[^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. +[^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 1.57 or higher. Only header-only (no compiled libraries) components needed. +[^7]: Boost 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. +[^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::cxx`, the PP is actually compiled against, but for the header-only target, 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. +[^9]: Building the Libint2 library with C++11 API needs the Boost Preprocessor (PP) component. For the compiled C++11 interface, `Libint2::cxx`, the PP is actually compiled against, but for the header-only target, 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/`. +[^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 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. +[^11]: Building the Libint2 library with C++11 API needs the header-only Eigen 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::cxx` requires Eigen. It is *strongly* recommended that the same installation of Eigen be used both to build and consume the `Libint2::cxx` target, especially as regards configuring BLAS and other backends. +[^12]: Consuming an installed Libint2 library through the compiled C++11 interface, `Libint2::cxx` requires Eigen. It is *strongly* recommended that the same installation of Eigen be used both to build and consume the `Libint2::cxx` target, especially as regards configuring BLAS and other backends. # Synopsis From 65fbb538a13d7e5abdb9705baa2857b59846b8ce Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 28 Jan 2022 22:49:19 -0500 Subject: [PATCH 055/182] help fortran maybe --- src/lib/libint/CMakeLists.txt.export | 31 +++++++++++++++++++++------- src/lib/libint/tests/CMakeLists.txt | 5 +++-- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index ad3105823..e0f70bb8c 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -90,6 +90,8 @@ message(STATUS "Showing option LIBINT2_INSTALL_CMAKEDIR: ${LIBINT2_INSTALL_CMAKE 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) @@ -420,7 +422,7 @@ endif() 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! @@ -463,23 +465,36 @@ if (ENABLE_FORTRAN) # 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}" + ) endif() diff --git a/src/lib/libint/tests/CMakeLists.txt b/src/lib/libint/tests/CMakeLists.txt index 6885d7df1..a11cca6a4 100644 --- a/src/lib/libint/tests/CMakeLists.txt +++ b/src/lib/libint/tests/CMakeLists.txt @@ -129,10 +129,12 @@ 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::int2 libint_f) - target_include_directories(fortran_example-libint2 PRIVATE $) target_compile_definitions(fortran_example-libint2 PRIVATE -D__COMPILING_LIBINT2=1) # Test 11 @@ -147,7 +149,6 @@ 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_compile_definitions(fortran_test-libint2 PRIVATE -D__COMPILING_LIBINT2=1) # Test 13 From 30f085e4637933d0d76f3ac3ce0aa22ebbfec4df Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 28 Jan 2022 22:55:40 -0500 Subject: [PATCH 056/182] incomplete eigen edits --- cmake/modules/FindTargetEigen3.cmake | 39 +++++++++++++++------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/cmake/modules/FindTargetEigen3.cmake b/cmake/modules/FindTargetEigen3.cmake index 1fb2b35e4..4af0771f1 100644 --- a/cmake/modules/FindTargetEigen3.cmake +++ b/cmake/modules/FindTargetEigen3.cmake @@ -63,30 +63,33 @@ else() endif() else() # 3rd precedence - usual variables from Eigen3Config.cmake - find_package (Eigen3 QUIET CONFIG) -# find_package (Eigen3 QUIET MODULE) -# Eigen3::Eigen - if (NOT ${PN}_FIND_QUIETLY) - message (STATUS "Eigen3 detected.") - endif() + #find_package (Eigen3 QUIET CONFIG) + find_package (Eigen3 QUIET MODULE) + if (TARGET Eigen3::Eigen) + if (NOT ${PN}_FIND_QUIETLY) + message (STATUS "Eigen3 detected.") + endif() - add_library (tgt::Eigen INTERFACE IMPORTED) + add_library (tgt::Eigen INTERFACE IMPORTED) - get_property(_iid1 TARGET Eigen3::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES) - set_property (TARGET tgt::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_iid1}) -# set_property (TARGET tgt::eigen PROPERTY INTERFACE_LINK_LIBRARIES ${HDF5_LIBRARIES}) - #set_property (TARGET tgt::hdf5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS}) - set (${PN}_VERSION ${Eigen3_VERSION}) + get_property(_iid1 TARGET Eigen3::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + set_property (TARGET tgt::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_iid1}) + # set_property (TARGET tgt::eigen PROPERTY INTERFACE_LINK_LIBRARIES ${HDF5_LIBRARIES}) + #set_property (TARGET tgt::hdf5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS}) + set (${PN}_VERSION ${Eigen3_VERSION}) - #unset (HDF5_FOUND) - #unset (HDF5_VERSION) - #unset (HDF5_LIBRARIES) - #unset (HDF5_INCLUDE_DIRS) + #unset (HDF5_FOUND) + #unset (HDF5_VERSION) + #unset (HDF5_LIBRARIES) + #unset (HDF5_INCLUDE_DIRS) + endif() endif() endif() -get_property(_iid TARGET tgt::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES) -set(${PN}_MESSAGE "Found Eigen3: ${_iid} (found version ${${PN}_VERSION})") +if (TARGET tgt::Eigen) + get_property(_iid TARGET tgt::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + set(${PN}_MESSAGE "Found Eigen3: ${_iid} (found version ${${PN}_VERSION})") +endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(${PN} From 0b5f80789fa7463431b4d46ac58cd4a7041afc7d Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Sat, 29 Jan 2022 00:00:56 -0500 Subject: [PATCH 057/182] fix eigen --- cmake/libint2-config.cmake.in | 2 +- cmake/modules/FindTargetEigen3.cmake | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index 65e45fcae..f3120a217 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -96,7 +96,7 @@ set(pnv libint2) # projectnameversion set(L2 Libint2) # NameSpace -set(Libint2_EXT_VERSION @LIBINT_EXT_VERSION@) +set(Libint2_EXT_VERSION "@LIBINT_EXT_VERSION@") # make detectable the various cmake modules exported alongside list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) diff --git a/cmake/modules/FindTargetEigen3.cmake b/cmake/modules/FindTargetEigen3.cmake index 4af0771f1..544336dbb 100644 --- a/cmake/modules/FindTargetEigen3.cmake +++ b/cmake/modules/FindTargetEigen3.cmake @@ -1,5 +1,5 @@ # FindTargetEigen3.cmake -# -------------------- +# ---------------------- # # Eigen3 cmake module to wrap Eigen3 suitable for Libint2, whether Eigen3Config, FindEigen3, or raw variables, in a target. # @@ -63,8 +63,8 @@ else() endif() else() # 3rd precedence - usual variables from Eigen3Config.cmake - #find_package (Eigen3 QUIET CONFIG) - find_package (Eigen3 QUIET MODULE) + find_package (Eigen3 QUIET CONFIG) + #find_package (Eigen3 MODULE) if (TARGET Eigen3::Eigen) if (NOT ${PN}_FIND_QUIETLY) message (STATUS "Eigen3 detected.") From 8e509c67014d3df6b17f9b59f50a24706703863d Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Sat, 29 Jan 2022 14:20:04 -0500 Subject: [PATCH 058/182] Update INSTALL.md --- INSTALL.md | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index c06189d8c..bbe653905 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -18,27 +18,23 @@ TODO straighten out target names, e.g., Libint2::cxx_ho and Libint2::cxx vs cxx lib with ENABLE_MPFR/LIBINT_HAS_MPFR needs gmpxx and mpfr (.tgz) unpacked if eigen found and system boost not found -| Task | Compilers | CMake[^3] | CMake generator | Boost[^7] | Eigen | GMPXX[^13] | MPFR[^19] | -| -------------------------------------------------------------------- | :---------------------: | :-------: | --------------- | :-------: | :----: | :--------: | :-------: | -| build target `build_libint` | C++[^1] | 🔵[^4] | Ninja | 🔵[^8] | – | 🔵 | – | -| build target `library` | C++[^1] | 🔵[^5] | Ninja | – | – | – | – | -|   `-D REQUIRE_CXX_API=ON` | C++[^1] | 🔵[^5] | Ninja | 🔸[^9] | 🔵[^11] | – | – | -|   `-D ENABLE_FORTRAN=ON` | C++[^1], Fortran[^2], C | 🔵[^5] | Ninja | – | – | – | – | -| build project linking C interface, `Libint2::int2` | C++[^1] | 🔸[^6] | Ninja, Makefile | – | – | – | – | -| build project linking C++11 header-only interface, `Libint2::cxx_ho` | C++[^1] | 🔸[^6] | Ninja, Makefile | 🔸[^10] | 🔵 | – | – | -|   `-D ENABLE_MPFR=ON` | C++[^1] | 🔸[^6] | Ninja, Makefile | 🔸[^10] | 🔵 | 🔵 | 🔵 | -| build project linking C++11 interface, `Libint2::cxx` | C++[^1] | 🔸[^6] | Ninja, Makefile | 🔸[^10] | 🔵[^12] | – | – | -| build project linking Fortran interface, `Libint2::fortran` | Fortran[^2] | 🔸[^6] | Ninja, Makefile | | | – | – | +| Task | Compilers | CMake[^3] | CMake generator | Boost[^7] | Eigen | GMPXX[^13] | MPFR[^14] | +| :------------------------------------------------------------------- | :---------------------: | :-------: | --------------- | :-------: | :-----: | :--------: | :-------: | +| build target `build_libint` | C++[^1] | 🔵[^4] | Ninja | 🔵[^8] | – | 🔵 | – | +| build target `library` | C++[^1] | 🔵[^5] | Ninja | – | – | – | – | +|   `-D REQUIRE_CXX_API=ON` | C++[^1] | 🔵[^5] | Ninja | 🔸[^9] | 🔵[^11] | – | – | +|   `-D ENABLE_FORTRAN=ON` | C++[^1], Fortran[^2], C | 🔵[^5] | Ninja | – | – | – | – | +| 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 - -(*) required to set up dependency for header-only interface, but not used until QC - -Boost: CMAKE_PREFIX_PATH BOOST_ROOT - [^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. @@ -55,14 +51,17 @@ Boost: CMAKE_PREFIX_PATH BOOST_ROOT [^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::cxx`, the PP is actually compiled against, but for the header-only target, 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. +[^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 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::cxx` requires Eigen. It is *strongly* recommended that the same installation of Eigen be used both to build and consume the `Libint2::cxx` target, especially as regards configuring BLAS and other backends. +[^12]: Consuming an installed Libint2 library through the compiled C++11 interface, `Libint2::int2-cxx` requires Eigen. 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 may satisfy 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. # Synopsis From 9ae21fc36e8448dd8514cf7533c0c29436e5dddd Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Sat, 29 Jan 2022 14:21:36 -0500 Subject: [PATCH 059/182] Update INSTALL.md --- INSTALL.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index bbe653905..2dbbf5111 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -14,10 +14,6 @@ Before you read on: # Prerequisites -TODO straighten out target names, e.g., Libint2::cxx_ho and Libint2::cxx vs cxx and int-cxx -lib with ENABLE_MPFR/LIBINT_HAS_MPFR needs gmpxx and mpfr -(.tgz) unpacked if eigen found and system boost not found - | Task | Compilers | CMake[^3] | CMake generator | Boost[^7] | Eigen | GMPXX[^13] | MPFR[^14] | | :------------------------------------------------------------------- | :---------------------: | :-------: | --------------- | :-------: | :-----: | :--------: | :-------: | | build target `build_libint` | C++[^1] | 🔵[^4] | Ninja | 🔵[^8] | – | 🔵 | – | From 81c3ebef2091a5a9170647ccd1c4ac4252457166 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Mon, 31 Jan 2022 14:31:31 -0500 Subject: [PATCH 060/182] misc tidying, tentative fort install --- INSTALL.md | 5 +++++ cmake/libint2-config.cmake.in | 1 - src/bin/libint/CMakeLists.txt | 9 +++++--- src/lib/libint/CMakeLists.txt.export | 32 +++++++++++++++++++++++++--- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 2dbbf5111..95979c4ba 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -281,6 +281,11 @@ These are the most useful configure options: * DNE --> `Libint2::int2-cxx` (internal target name `int-cxx-{shared,static}`) +## 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. ## program-specific notes diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index f3120a217..f0477e976 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -78,7 +78,6 @@ # # find_package(Libint2) # find_package(Libint2 2.7.1 CONFIG REQUIRED COMPONENTS shared sss eri_c4_d0_l5 eri_c4_d1_l4) -# find_package(Libint2 CONFIG REQUIRED COMPONENTS gss onebody_d0_l4 onebody_d1_l3 onebody_d2_l3 "eri_c4_d0_l${MAX_AM_ERI}" eri_c4_d1_l2 eri_c4_d2_l2 eri_c3_d0_l4 eri_c3_d1_l3 eri_c3_d2_l3 eri_c2_d0_l4 eri_c2_d1_l3 eri_c2_d2_l3) -DERI3_PURE_SH=OFF -DERI2_PURE_SH=OFF # for psi4 # # # The following variables can be set to guide the search for this package: diff --git a/src/bin/libint/CMakeLists.txt b/src/bin/libint/CMakeLists.txt index 0d4cb813f..ffb0b896f 100644 --- a/src/bin/libint/CMakeLists.txt +++ b/src/bin/libint/CMakeLists.txt @@ -57,10 +57,13 @@ 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::headers) - find_package(Multiprecision MODULE REQUIRED COMPONENTS gmpxx) -target_link_libraries(libint-libcompiler PUBLIC Multiprecision::gmpxx) +target_link_libraries( + libint-libcompiler + PUBLIC + Boost::headers + Multiprecision::gmpxx + ) get_property(_loc TARGET Multiprecision::gmp PROPERTY LOCATION) message(STATUS "${Cyan}Found GMP${ColourReset}: ${_loc}") diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index e0f70bb8c..393b2f187 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -37,7 +37,7 @@ include(options) 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 and Python)" OFF) -option_with_print(ENABLE_MPFR "Use GNU MPFR library for high-precision testing (EXPERTS ONLY)" 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(EXPORT_LOCAL_TARGETS "Install CMake targets with hard-coded dependency paths. Turn OFF when building library for redistribution." ON) @@ -188,8 +188,8 @@ endif() #if (TARGET libint-Eigen3) -# Python is optional, unless ... -if (ENABLE_FORTRAN) # ... need fortran +# 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) @@ -496,6 +496,22 @@ if (ENABLE_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() # <<< Install >>> @@ -678,6 +694,16 @@ if (BUILD_SHARED_LIBS) DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} COMPONENT ${L2}_Development ) + + if(ENABLE_FORTRAN) + install( + EXPORT fshared_set + FILE "${pnv}-targets-shared-fortran.cmake" + NAMESPACE "${L2}::" + DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} + COMPONENT ${L2}_Development_Fortran + ) + endif() endif() if (BUILD_STATIC_LIBS) From f24f65fd89ba6241273cbb91fcf0753ad91fa2d1 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Mon, 31 Jan 2022 19:56:47 -0500 Subject: [PATCH 061/182] ci 1 --- .github/workflows/cmake.yml | 57 ++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9fa7ddf56..7d16b92b8 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -9,16 +9,41 @@ jobs: 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-20.04 + # build_type: Debug + # cxx: g++-9 + + - runs-on: ubuntu-20.04 + build_type: Release + cxx: g++-9 + + #- runs-on: macos-latest + # build_type: Debug + # cxx: clang++ + + - runs-on: macos-latest + build_type: Release cxx: clang++ - name: "${{ matrix.os }}: ${{ matrix.cxx }} ${{ matrix.build_type }}" - runs-on: ${{ matrix.os }} + #- runs-on: windows-2022 + # build_type: Debug + # cxx: clang-cl + # args: > + # -DPYBIND11_FINDPYTHON=ON + # -DCMAKE_CXX_FLAGS="-D_=1" + + - runs-on: windows-2022 + build_type: Release + cxx: clang-cl + args: > + -DPYBIND11_FINDPYTHON=ON + -DCMAKE_CXX_FLAGS="-D_=1" + + #cxx: /usr/bin/g++-9 + + name: "${{ matrix.runs-on }} • ${{ matrix.cxx }} • • ${{ matrix.build_type }} • ${{ matrix.args }}" + runs-on: ${{ matrix.cfg.runs-on }} env: CXX : ${{ matrix.cxx }} CCACHE_DIR : ${{github.workspace}}/build/.ccache @@ -26,7 +51,7 @@ jobs: CCACHE_COMPRESSLEVEL : 6 BUILD_CONFIG : > -G Ninja - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} -DCMAKE_PREFIX_PATH=/usr/local/Cellar/eigen/3.3.9;/usr/local/opt/bison -DBUILD_SHARED_LIBS=OFF -DMPIEXEC_PREFLAGS='--bind-to;none;--allow-run-as-root' @@ -63,20 +88,26 @@ jobs: cmake -E make_directory ${{github.workspace}}/installed - name: Install prerequisite MacOS packages - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.os == 'macos-latest' }} + 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 - name: Install prerequisites Ubuntu packages - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.os == 'ubuntu-20.04' }} + 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 + - name: Install Windows prerequisites + if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Windows' }} + uses: crazy-max/ghaction-chocolatey@v1 + with: + args: install miniconda3 --yes + - name: Prepare ccache timestamp if: ${{ steps.skip_check.outputs.should_skip != 'true' }} id: ccache_cache_timestamp @@ -100,10 +131,8 @@ jobs: 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 check cmake --build build --target install - #cd src/bin/test_eri && ./stdtests.pl && cd ../../.. - name: Generate+build Libint library (FetchContent) if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.build_type != 'Debug'}} From 706270f6d9357f936869a5e441ca00a1c9a4c097 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Mon, 31 Jan 2022 20:34:58 -0500 Subject: [PATCH 062/182] ci 2 --- .github/workflows/cmake.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 7d16b92b8..bc23a6fa2 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -1,4 +1,4 @@ -name: Linux/MacOS Build +name: CI on: [push, pull_request] @@ -42,10 +42,10 @@ jobs: #cxx: /usr/bin/g++-9 - name: "${{ matrix.runs-on }} • ${{ matrix.cxx }} • • ${{ matrix.build_type }} • ${{ matrix.args }}" + name: "${{ 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 }} CCACHE_DIR : ${{github.workspace}}/build/.ccache CCACHE_COMPRESS : true CCACHE_COMPRESSLEVEL : 6 @@ -126,7 +126,7 @@ jobs: ${{ matrix.config.name }}-ccache- - name: Generate+build Libint library (ExternalProject) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.build_type == 'Debug'}} + if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Debug'}} shell: bash working-directory: ${{github.workspace}} run: | @@ -135,7 +135,7 @@ jobs: cmake --build build --target install - name: Generate+build Libint library (FetchContent) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.build_type != 'Debug'}} + if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type != 'Debug'}} shell: bash working-directory: ${{github.workspace}} run: | From 38fb7861c654996e41a82e9dc8fefdbceb8a013e Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Mon, 31 Jan 2022 22:07:27 -0500 Subject: [PATCH 063/182] ci 3 --- .github/workflows/cmake.yml | 47 +++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index bc23a6fa2..2b7a83d15 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -11,34 +11,38 @@ jobs: matrix: cfg: #- runs-on: ubuntu-20.04 - # build_type: Debug + # build_type: Release # cxx: g++-9 - runs-on: ubuntu-20.04 - build_type: Release + build_type: Debug cxx: g++-9 + args: > + -DENABLE_FORTRAN=ON #- runs-on: macos-latest - # build_type: Debug + # build_type: Release # cxx: clang++ - runs-on: macos-latest - build_type: Release + build_type: Debug cxx: clang++ + args: > + -DENABLE_FORTRAN=ON #- runs-on: windows-2022 - # build_type: Debug + # build_type: Release # cxx: clang-cl # args: > # -DPYBIND11_FINDPYTHON=ON # -DCMAKE_CXX_FLAGS="-D_=1" - runs-on: windows-2022 - build_type: Release + build_type: Debug cxx: clang-cl - args: > - -DPYBIND11_FINDPYTHON=ON - -DCMAKE_CXX_FLAGS="-D_=1" + #args: > + # -DPYBIND11_FINDPYTHON=ON + # -DCMAKE_CXX_FLAGS="-D_=1" #cxx: /usr/bin/g++-9 @@ -55,7 +59,6 @@ jobs: -DCMAKE_PREFIX_PATH=/usr/local/Cellar/eigen/3.3.9;/usr/local/opt/bison -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=3;2 -DWITH_ERI_MAX_AM=2;2 @@ -90,24 +93,32 @@ jobs: - name: Install prerequisite MacOS packages 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 + # bison + #echo "FC=/usr/local/bin/gfortran-10" >> $GITHUB_ENV + #echo "EIGEN3_INCLUDE_DIR=/usr/local/include/eigen3" >> $GITHUB_ENV - name: Install prerequisites Ubuntu packages 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 }} 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 - - name: Install Windows prerequisites + - name: Install Windows prerequisites (part 1) if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Windows' }} uses: crazy-max/ghaction-chocolatey@v1 with: args: install miniconda3 --yes + - name: Install Windows prerequisites (part 2) + if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Windows' }} + run: | + conda install ninja cmake python mpir boost eigen ccache -c conda-forge --yes + conda info + conda list + - name: Prepare ccache timestamp if: ${{ steps.skip_check.outputs.should_skip != 'true' }} id: ccache_cache_timestamp @@ -139,7 +150,7 @@ jobs: shell: bash working-directory: ${{github.workspace}} run: | - cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLIBINT_BUILD_LIBRARY_AS_SUBPROJECT=ON $BUILD_CONFIG + cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLIBINT_BUILD_LIBRARY_AS_SUBPROJECT=ON $BUILD_CONFIG ${{ matrix.cfg.args }} cmake --build build --target libint-library-export cmake --build build --target check-libint2compiler cmake --build build --target check-libint2 From b7b562c2721afdc5c03eecdc041e5df69d9bbf23 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Mon, 31 Jan 2022 23:53:17 -0500 Subject: [PATCH 064/182] ci 4 --- .github/workflows/cmake.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2b7a83d15..1b2e23041 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -94,7 +94,6 @@ jobs: if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'macOS' }} run: | brew install ninja gcc@10 boost eigen ccache - # bison #echo "FC=/usr/local/bin/gfortran-10" >> $GITHUB_ENV #echo "EIGEN3_INCLUDE_DIR=/usr/local/include/eigen3" >> $GITHUB_ENV @@ -114,7 +113,9 @@ jobs: - name: Install Windows prerequisites (part 2) if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Windows' }} + shell: bash run: | + set PATH=C:\tools\miniconda3\Scripts;C:\tools\miniconda3;C:\tools\miniconda3\Library\bin;%PATH% conda install ninja cmake python mpir boost eigen ccache -c conda-forge --yes conda info conda list @@ -142,7 +143,8 @@ jobs: working-directory: ${{github.workspace}} run: | cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE $BUILD_CONFIG - cmake --build build --target check + cmake --build build + cmake --build build --target check-libint2compiler cmake --build build --target install - name: Generate+build Libint library (FetchContent) From 19d0c01ff026f29a5bd8949235566fd0e8aef3c5 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 1 Feb 2022 00:07:56 -0500 Subject: [PATCH 065/182] ci 5 --- .github/workflows/cmake.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 1b2e23041..70bc7a26a 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -56,7 +56,6 @@ jobs: BUILD_CONFIG : > -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} - -DCMAKE_PREFIX_PATH=/usr/local/Cellar/eigen/3.3.9;/usr/local/opt/bison -DBUILD_SHARED_LIBS=OFF -DMPIEXEC_PREFLAGS='--bind-to;none;--allow-run-as-root' -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/installed @@ -115,7 +114,7 @@ jobs: if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Windows' }} shell: bash run: | - set PATH=C:\tools\miniconda3\Scripts;C:\tools\miniconda3;C:\tools\miniconda3\Library\bin;%PATH% + set PATH=/c/tools/miniconda3/Scripts:/c/tools/miniconda3:/c/tools/miniconda3/Library/bin:$PATH conda install ninja cmake python mpir boost eigen ccache -c conda-forge --yes conda info conda list From 84b3c6c2cc9df6fbf6599c275a594552a51351a5 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 1 Feb 2022 00:22:23 -0500 Subject: [PATCH 066/182] ci 6 --- .github/workflows/cmake.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 70bc7a26a..9767d072b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -119,6 +119,22 @@ jobs: conda info conda list + - name: Install Windows prerequisites: part 1, Create Conda Environment + 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 + + - name: Install Windows prerequisites: part 2, Environment Information + shell: bash -l {0} + run: | + conda info + conda install ninja cmake python mpir boost eigen ccache -c conda-forge --yes + conda list + - name: Prepare ccache timestamp if: ${{ steps.skip_check.outputs.should_skip != 'true' }} id: ccache_cache_timestamp From 694c337bfb0e9f571e63759e921050af4891da91 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 1 Feb 2022 00:41:02 -0500 Subject: [PATCH 067/182] ci 7 --- .github/workflows/cmake.yml | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9767d072b..83b40c579 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -24,11 +24,11 @@ jobs: # build_type: Release # cxx: clang++ - - runs-on: macos-latest - build_type: Debug - cxx: clang++ - args: > - -DENABLE_FORTRAN=ON + #- runs-on: macos-latest + # build_type: Debug + # cxx: clang++ + # args: > + # -DENABLE_FORTRAN=ON #- runs-on: windows-2022 # build_type: Release @@ -104,20 +104,6 @@ jobs: #echo "FC=/usr/bin/gfortran-9" >> $GITHUB_ENV #echo "EIGEN3_INCLUDE_DIR=/usr/include/eigen3" >> $GITHUB_ENV - - name: Install Windows prerequisites (part 1) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Windows' }} - uses: crazy-max/ghaction-chocolatey@v1 - with: - args: install miniconda3 --yes - - - name: Install Windows prerequisites (part 2) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Windows' }} - shell: bash - run: | - set PATH=/c/tools/miniconda3/Scripts:/c/tools/miniconda3:/c/tools/miniconda3/Library/bin:$PATH - conda install ninja cmake python mpir boost eigen ccache -c conda-forge --yes - conda info - conda list - name: Install Windows prerequisites: part 1, Create Conda Environment uses: conda-incubator/setup-miniconda@v2 From 33fa36d94e01b304d7a86e3f793255911adb3651 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 1 Feb 2022 10:27:31 -0500 Subject: [PATCH 068/182] ci 8 --- .github/workflows/cmake.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 83b40c579..6c2923dee 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -40,6 +40,7 @@ jobs: - runs-on: windows-2022 build_type: Debug cxx: clang-cl + #args: > # -DPYBIND11_FINDPYTHON=ON # -DCMAKE_CXX_FLAGS="-D_=1" @@ -105,7 +106,8 @@ jobs: #echo "EIGEN3_INCLUDE_DIR=/usr/include/eigen3" >> $GITHUB_ENV - - name: Install Windows prerequisites: part 1, Create Conda Environment + - 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: "" @@ -114,7 +116,8 @@ jobs: conda-build-version: "*" show-channel-urls: true - - name: Install Windows prerequisites: part 2, Environment Information + - 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 From b0ab1da9adc8d69317653fbbfe670807cf806c43 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 1 Feb 2022 11:40:47 -0500 Subject: [PATCH 069/182] ci 9 --- .github/workflows/cmake.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6c2923dee..2545df317 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -17,6 +17,7 @@ jobs: - runs-on: ubuntu-20.04 build_type: Debug cxx: g++-9 + fc: gfortran-9 args: > -DENABLE_FORTRAN=ON @@ -101,11 +102,10 @@ jobs: if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Linux' }} run: | sudo apt-get update - sudo apt-get install ninja-build ${{ matrix.cfg.cxx }} gfortran-9 liblapack-dev libmpfr-dev libboost-dev libeigen3-dev ccache + sudo apt-get install ninja-build ${{ matrix.cfg.cxx }} ${{ matrix.cfg.fc }} 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 - - 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 @@ -143,7 +143,7 @@ jobs: - name: Generate+build Libint library (ExternalProject) if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Debug'}} - shell: bash + shell: bash -l {0} working-directory: ${{github.workspace}} run: | cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE $BUILD_CONFIG From 8d2dcdc097ff4d0c402f3a2a4d2f5153cf4058b5 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 1 Feb 2022 15:30:43 -0500 Subject: [PATCH 070/182] ci 10 --- .github/workflows/cmake.yml | 6 ++++++ src/lib/libint/CMakeLists.txt.export | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2545df317..990f91d60 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -124,6 +124,12 @@ jobs: conda install ninja cmake 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' }} id: ccache_cache_timestamp diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 393b2f187..dc481f035 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -211,7 +211,9 @@ 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 "${_source_count} files in LIBINT2_LIBRARY_CXX_SRC") +message(DEBUG "LIBINT2_LIBRARY_CXX_SRC=${LIBINT2_LIBRARY_CXX_SRC}") add_library(int-obj OBJECT "${LIBINT2_LIBRARY_CXX_SRC}") From a9715f9d1e530b7fe61695880668266c7e5cc29b Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 1 Feb 2022 16:20:16 -0500 Subject: [PATCH 071/182] ci 11 --- .github/workflows/cmake.yml | 8 ++++++-- INSTALL.md | 4 ++-- src/lib/libint/CMakeLists.txt | 2 +- src/lib/libint/CMakeLists.txt.export | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 990f91d60..7cdc81345 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -17,6 +17,7 @@ jobs: - runs-on: ubuntu-20.04 build_type: Debug cxx: g++-9 + cc: gcc-9 fc: gfortran-9 args: > -DENABLE_FORTRAN=ON @@ -41,13 +42,16 @@ jobs: - runs-on: windows-2022 build_type: Debug cxx: clang-cl + cc: clang-cl + args: > + -DCMAKE_C_COMPILER=clang-cl - #args: > - # -DPYBIND11_FINDPYTHON=ON # -DCMAKE_CXX_FLAGS="-D_=1" #cxx: /usr/bin/g++-9 + #-DCMAKE_PREFIX_PATH=/usr/local/Cellar/eigen/3.3.9 + name: "${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.cxx }} • • ${{ matrix.cfg.build_type }} • ${{ matrix.cfg.args }}" runs-on: ${{ matrix.cfg.runs-on }} env: diff --git a/INSTALL.md b/INSTALL.md index 95979c4ba..e44df3757 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -17,8 +17,8 @@ Before you read on: | Task | Compilers | CMake[^3] | CMake generator | Boost[^7] | Eigen | GMPXX[^13] | MPFR[^14] | | :------------------------------------------------------------------- | :---------------------: | :-------: | --------------- | :-------: | :-----: | :--------: | :-------: | | build target `build_libint` | C++[^1] | 🔵[^4] | Ninja | 🔵[^8] | – | 🔵 | – | -| build target `library` | C++[^1] | 🔵[^5] | Ninja | – | – | – | – | -|   `-D REQUIRE_CXX_API=ON` | C++[^1] | 🔵[^5] | Ninja | 🔸[^9] | 🔵[^11] | – | – | +| build target `library` | C++[^1], C | 🔵[^5] | Ninja | – | – | – | – | +|   `-D REQUIRE_CXX_API=ON` | C++[^1], C | 🔵[^5] | Ninja | 🔸[^9] | 🔵[^11] | – | – | |   `-D ENABLE_FORTRAN=ON` | C++[^1], Fortran[^2], C | 🔵[^5] | Ninja | – | – | – | – | | build project _consuming_ Libint2 library | |  C interface (I/F), `Libint2::int2` | C++[^1] | 🔸[^6] | Ninja, Makefile | – | – | – | – | diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index 86b2b7e66..abd8e8be0 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -34,7 +34,7 @@ add_custom_target(libint-library-populate DEPENDS ${EXPORT_STAGE_DIR}/CMakeLists # <<< 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 tarball of Libint2 library source") diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index dc481f035..3c65aaab1 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -212,7 +212,7 @@ configure_file(include/libint2/config2.h.cmake.in include/libint2/config2.h @ONL include(srclist.cmake) list(LENGTH LIBINT2_LIBRARY_CXX_SRC _source_count) -message(STATUS "${_source_count} files in LIBINT2_LIBRARY_CXX_SRC") +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}") From 84ea2b3ee3570cae8995d5427641c4cf3e20bf3a Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 1 Feb 2022 16:41:24 -0500 Subject: [PATCH 072/182] ci 12 --- .github/workflows/cmake.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 7cdc81345..2e82bc476 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -40,7 +40,7 @@ jobs: # -DCMAKE_CXX_FLAGS="-D_=1" - runs-on: windows-2022 - build_type: Debug + build_type: Release cxx: clang-cl cc: clang-cl args: > @@ -52,7 +52,7 @@ jobs: #-DCMAKE_PREFIX_PATH=/usr/local/Cellar/eigen/3.3.9 - name: "${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.cxx }} • • ${{ matrix.cfg.build_type }} • ${{ matrix.cfg.args }}" + name: "${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.cxx }} • ${{ matrix.cfg.build_type }} • ${{ matrix.cfg.args }}" runs-on: ${{ matrix.cfg.runs-on }} env: CXX : ${{ matrix.cfg.cxx }} @@ -152,17 +152,17 @@ jobs: ${{ matrix.config.name }}-ccache- - name: Generate+build Libint library (ExternalProject) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Debug'}} + 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 -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE $BUILD_CONFIG ${{ matrix.cfg.args }} cmake --build build cmake --build build --target check-libint2compiler cmake --build build --target install - name: Generate+build Libint library (FetchContent) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type != 'Debug'}} + if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Debug'}} shell: bash working-directory: ${{github.workspace}} run: | @@ -181,7 +181,7 @@ jobs: cat > CMakeLists.txt < Date: Tue, 1 Feb 2022 17:14:22 -0500 Subject: [PATCH 073/182] ci 13 --- .github/workflows/cmake.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2e82bc476..84b96b779 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -120,6 +120,9 @@ jobs: 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} @@ -175,13 +178,13 @@ jobs: - name: Test installed Libint library 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 < Date: Tue, 1 Feb 2022 17:55:55 -0500 Subject: [PATCH 074/182] ci 14 --- .github/workflows/cmake.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 84b96b779..da94fde04 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -181,6 +181,8 @@ jobs: shell: bash -l {0} working-directory: ${{github.workspace}}/test_installed_library run: | + ls ${{github.workspace}}/installed + ls ${{github.workspace}}\installed cat > CMakeLists.txt < Date: Tue, 1 Feb 2022 18:23:56 -0500 Subject: [PATCH 075/182] ci 15 --- .github/workflows/cmake.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index da94fde04..4ca84395e 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -181,8 +181,6 @@ jobs: shell: bash -l {0} working-directory: ${{github.workspace}}/test_installed_library run: | - ls ${{github.workspace}}/installed - ls ${{github.workspace}}\installed cat > CMakeLists.txt < Date: Tue, 1 Feb 2022 20:37:26 -0500 Subject: [PATCH 076/182] ci 16 --- .github/workflows/cmake.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4ca84395e..8a1efa959 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -184,11 +184,13 @@ jobs: cat > CMakeLists.txt < Date: Tue, 1 Feb 2022 21:17:24 -0500 Subject: [PATCH 077/182] ci 17 --- .github/workflows/cmake.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 8a1efa959..6b295fdea 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -159,7 +159,7 @@ jobs: shell: bash -l {0} working-directory: ${{github.workspace}} run: | - cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE $BUILD_CONFIG ${{ matrix.cfg.args }} + cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} $BUILD_CONFIG ${{ matrix.cfg.args }} cmake --build build cmake --build build --target check-libint2compiler cmake --build build --target install @@ -169,7 +169,7 @@ jobs: shell: bash working-directory: ${{github.workspace}} run: | - cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLIBINT_BUILD_LIBRARY_AS_SUBPROJECT=ON $BUILD_CONFIG ${{ matrix.cfg.args }} + 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 libint-library-export cmake --build build --target check-libint2compiler cmake --build build --target check-libint2 @@ -184,6 +184,7 @@ jobs: cat > CMakeLists.txt < Date: Tue, 1 Feb 2022 21:40:19 -0500 Subject: [PATCH 078/182] ci 18 --- .github/workflows/cmake.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6b295fdea..5aec57f91 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -192,6 +192,6 @@ jobs: add_executable(hf++ EXCLUDE_FROM_ALL ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock++.cc) target_link_libraries(hf++ Libint2::cxx Threads::Threads) EOF - cmake . -D Libint2_DIR=${{github.workspace}}/installed/lib/cmake/libint2 -D CMAKE_PREFIX_PATH=${{github.workspace}}/installed -D CMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} - cmake --build . --target hf++ - ./hf++ ${{github.workspace}}/src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock++-validate.py ${{github.workspace}}/build/libint-2*/features + cmake -S . -B build -D Libint2_DIR=${{github.workspace}}/installed/lib/cmake/libint2 -D CMAKE_PREFIX_PATH=${{github.workspace}}/installed -D CMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} + cmake --build build --target hf++ + ./build/hf++ ${{github.workspace}}/src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock++-validate.py ${{github.workspace}}/build/libint-2*/features From 7d73ab932c3cd5f756cc43ef686b751e732f7601 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 1 Feb 2022 22:49:04 -0500 Subject: [PATCH 079/182] ci 19 --- .github/workflows/cmake.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 5aec57f91..084b49346 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -181,6 +181,7 @@ jobs: shell: bash -l {0} working-directory: ${{github.workspace}}/test_installed_library run: | + echo $CXX cat > CMakeLists.txt < Date: Tue, 1 Feb 2022 23:30:57 -0500 Subject: [PATCH 080/182] ci 20 --- .github/workflows/cmake.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 084b49346..04f997630 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -181,7 +181,6 @@ jobs: shell: bash -l {0} working-directory: ${{github.workspace}}/test_installed_library run: | - echo $CXX cat > CMakeLists.txt < Date: Wed, 2 Feb 2022 00:03:51 -0500 Subject: [PATCH 081/182] ci 21 --- .github/workflows/cmake.yml | 10 +- .../hartree-fock/hartree-fock-cpp-validate.py | 165 ++ .../tests/hartree-fock/hartree-fock-cpp.cc | 2538 +++++++++++++++++ 3 files changed, 2708 insertions(+), 5 deletions(-) create mode 100644 src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py create mode 100644 src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 04f997630..626d3d944 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -183,15 +183,15 @@ jobs: run: | cat > CMakeLists.txt < tolerance): + ok = False + print(label, "check: failed\nreference:", refdata, "\nactual:", textline) + break + if (ok): print(label, "check: passed") + return ok + +assert(len(sys.argv) > 1) +# first arg is the path to MakeVars.features +path_to_libfeatures = sys.argv[1] +# second arg is the input file, if missing read sys.stdin +try: + instr = open(sys.argv[2]) if len(sys.argv) > 2 else sys.stdin +except Exception as e: + sys.exit(2) + +if os.path.exists(path_to_libfeatures): + # define boolean constants used in MakeVars.features + no = False + yes = True + exec(open(path_to_libfeatures).read()) +else: + sys.exit(2) + +# ignore test if ERI_MAX_AM is too low +if LIBINT_ERI_MAX_AM<2: + sys.exit(0) + +eref = [-76.003354058439] +etol = 5e-12 + +muref = [-0.263282355191187, -0.0912036831854911, -0.105312942076475] +mutol = 1e-9 + +Qref = [-7.01719638074453, 0.024624345507934, -0.576201299024159, + -8.04716669024124, 0.638204907990955, -6.35134519242917 ] +Qtol = 1e-8 + +smuref = [-muref[1]/2, muref[2], -muref[0]/2] +smutol = 1e-9 + +sQref = [Qref[1]/4, -Qref[4]/2, (2*Qref[5] - Qref[0] - Qref[3])/4, + -Qref[2]/2, (Qref[0] - Qref[3])/8 ] +sQtol = 1e-8 + +F1ref = [-5.43569555903312, -1.88298017654395, -2.17427822361352, + 3.47022732536532, -2.96798871167808, 2.59189820350226, + 1.9654682336678, 4.85096888822203, -0.417619979888738 ] +F1tol = 1e-9 +F1ok = False if LIBINT_ONEBODY_DERIV>0 else True + +FPref = [ 0.355265310323155, 0.123067513529209, 0.142106124129298, + -0.224258642015539, 0.180741977786854, -0.164305035772324, + -0.131006668307617, -0.303809491316068, 0.0221989116430271 ] +FPtol = 1e-9 +FPok = False if LIBINT_ONEBODY_DERIV>0 else True + +F2ref = [ 2.95100851670393, 1.02225933689958, 1.18040340668181, + -1.89116113654409, 1.64868682617684, -1.42151545972338, + -1.05984738015984, -2.67094616307642, 0.241112053041571 ] +F2tol = 1e-9 +F2ok = False if LIBINT_ERI_DERIV>0 else True + +FNref = [ 2.01500148332517 , 0.698016989289171, 0.806000593330069, + -1.28187870168764 , 1.07670120707691 , -0.951756216715147, + -0.733122781637531, -1.77471819636609 , 0.145755623385078 ] +FNtol = 1e-10 +FNok = False if LIBINT_ONEBODY_DERIV>0 and LIBINT_ERI_DERIV>0 else True + +Fref = [ -0.114420248680859, -0.0396363368259882, -0.0457680994723476, + 0.0729288451180514, -0.0618587006374771, 0.0543214912914121, + 0.0414914035628126, 0.101495037463456, -0.00855339181906306 ] +Ftol = 1e-9 +Fok = False if LIBINT_ONEBODY_DERIV>0 and LIBINT_ERI_DERIV>0 else True + +H1ref = [ 3.54760842822125, 0.0561425790590885, -1.84088034418252, -0.887601426360438, -2.17549130368644, 1.98344832758524, -2.66000700186171, 2.11934872462735, -0.142567983402711, 0.355853985722548, 2.00292709856151, -2.17850638711514, -1.77309201081378, -1.61619662181537, 2.12236380805605, 1.41723802509125, -0.386730476746138, 5.69831976160228, 1.98431870719983, -1.61468908010102, -2.14019765060108, -0.143438363017304, -0.38823801846049, -3.55812211100127, 0.904263134266358, 2.18335388755013, -1.98924643233292, -0.0166617079059194, -0.00484750043498585, 0.00492772513309295, 1.75328800656853, 1.63118422308913, -0.00786258386369225, 0.0198040042452449, -0.0164951429881064, 2.15669050290334, 0.00579810474768649, -0.0149876012737541, -0.0164928523022598, 2.67666870976763, -2.11450122419236, 0.137640258269618, -1.43704202933649, 0.403225619734244, 3.57461496330354 ] +H1tol = 1e-9 +H1ok = False if LIBINT_ONEBODY_DERIV>1 else True + +HPref = [ -0.373657119664361, -0.00133454389521286, 0.0913757616853391, 0.144293176019879, 0.103810096183052, -0.0967303414175233, 0.229363943644482, -0.102475552287839, 0.00535457973218418, -0.221600106461453, -0.0970957473238979, 0.103810096183052, 0.187363744093183, 0.0780172520149254, -0.102475552287839, 0.0342363623684173, 0.0190784953089725, -0.481921134987926, -0.0967303414175233, 0.0780172520149254, 0.206932260444167, 0.00535457973218418, 0.0190784953089725, 0.27498887454376, -0.141868433944075, -0.102526043925858, 0.096303732812767, -0.00242474207580482, -0.00128405225719423, 0.000426608604756398, -0.191255819949221, -0.0755194237363812, -0.00128405225719423, 0.00389207585603787, -0.00249782827854418, -0.205330014292075, 0.000426608604756397, -0.00249782827854418, -0.00160224615209187, -0.226939201568677, 0.103759604545033, -0.00578118833694058, -0.038128438224455, -0.0165806670304283, -0.273386628391668 ] +HPtol = 1e-9 +HPok = False if LIBINT_ONEBODY_DERIV>1 else True + +H2ref = [ -2.97603189152785, -0.04203457482293, 0.898032292915088, 1.06445776362688, 1.08388172281076, -0.967617771471307, 1.91157412790108, -1.04184714798783, 0.0695854785562199, -1.3547383073865, -1.00051785461617, 1.01230086799738, 1.43977388154118, 0.775813430173996, -0.970266293174445, -0.0850355741545849, 0.224704424442172, -4.00998703146547, -0.946954158573641, 0.811603857580693, 1.66614697002347, 0.0489218656585546, 0.188913997035478, 2.34384006144209, -1.07351307118258, -1.0520106170714, 0.957147912300498, 0.00905530755570372, 0.0397097490740273, -0.0101937537268573, -1.43185263066289, -0.799836089947826, -0.0318711057393559, -0.00792125087828533, -0.0117677676328675, -1.67096353575741, 0.0104698591708088, 0.024022659773826, 0.004816565733943, -1.92062943545679, 1.0021373989138, -0.0593917248293631, 0.0929568250328693, -0.212936656809304, -2.34865662717603 ] +H2tol = 1e-9 +H2ok = False if LIBINT_ERI_DERIV>1 else True + +HNref = [ -0.0951342315737215, 0.00935257129239186, 0.840399911304933, -0.357531998589061, 0.977636861834156, -0.906318892903572, 0.452666230162782, -0.986989433126548, 0.0659189815986388, 1.20846783390926, -0.858405092966087, 0.977636861834156, 0.124944488922027, 0.709863445763144, -0.986989433126549, -1.33341232283129, 0.148541647202943, -1.11333360233554, -0.906318892903572, 0.709863445763144, 0.232587509667034, 0.0659189815986388, 0.148541647202943, 0.880746092668508, 0.331757531616028, -0.99149148862787, 0.91165154124282, 0.0257744669730324, 0.0138546267937132, -0.00533264833924809, -0.0813945274848341, -0.737572699350571, 0.0138546267937132, -0.0435499614371927, 0.0277092535874264, -0.250363004131194, -0.00533264833924809, 0.0277092535874264, 0.0177754944641603, -0.478440697135815, 0.973134806332835, -0.0605863332593907, 1.37696228426848, -0.176250900790369, -0.898521587132668 ] +HNtol = 1e-10 +HNok = False if LIBINT_ONEBODY_DERIV>1 and LIBINT_ERI_DERIV>1 else True + +Href = [ 0.102785185455314, 0.0221260316333375, -0.0110723782771648, -0.0363824853027409, -0.0101626228584681, 0.012781321792833, -0.0664027001533642, -0.0119634087748708, -0.00170894351566768, -0.0120165942161412, 0.0469084036553551, -0.0847585611005566, -0.0210098962573883, -0.0525024938633059, 0.0626325294672223, 0.0330264904737867, 0.0055940902079491, 0.0930779928133423, 0.0343153143050929, -0.0152045247422558, -0.0345309104664071, -0.0232429360279265, -0.0317038789130969, -0.0585470823469183, 0.0206391607557284, 0.0373257379249965, -0.0241432459768363, 0.015743324547012, 0.0474328231755604, -0.010172068328256, 0.0487850284715841, 0.0182560100543473, -0.0271631150665291, -0.0277751322141953, -0.00305148531209163, 0.0300339487226562, 0.0113619241840036, 0.0342464838089542, 0.00449696174375165, 0.0506593756063487, -0.0354694144006902, 0.0118810118439231, -0.005251358259593, -0.00254260489585742, 0.0540501206031722 ] +Htol = 1e-9 +Hok = False if LIBINT_ONEBODY_DERIV>1 and LIBINT_ERI_DERIV>1 else True + +for line in instr: + match1 = re.match('\*\* Hartree-Fock energy =' + pat_numbers(1), line) + match2 = re.match('\*\* edipole =' + pat_numbers(3), line) + match3 = re.match('\*\* equadrupole =' + pat_numbers(6), line) + match4 = re.match('\*\* 1-body forces =' + pat_numbers(9), line) + match5 = re.match('\*\* Pulay forces =' + pat_numbers(9), line) + match6 = re.match('\*\* 2-body forces =' + pat_numbers(9), line) + match7 = re.match('\*\* nuclear repulsion forces =' + pat_numbers(9), line) + match8 = re.match('\*\* Hartree-Fock forces =' + pat_numbers(9), line) + match9 = re.match('\*\* 1-body hessian =' + pat_numbers(45), line) + match10 = re.match('\*\* Pulay hessian =' + pat_numbers(45), line) + match11 = re.match('\*\* 2-body hessian =' + pat_numbers(45), line) + match12 = re.match('\*\* nuclear repulsion hessian =' + pat_numbers(45), line) + match13 = re.match('\*\* Hartree-Fock hessian =' + pat_numbers(45), line) + match14 = re.match('\*\* sph edipole =' + pat_numbers(3), line) + match15 = re.match('\*\* sph equadrupole =' + pat_numbers(5), line) + if match1: + eok = validate("HF energy", match1.groups(), eref, etol, line) + elif match2: + muok = validate("electric dipole moment", match2.groups(), muref, mutol, line) + elif match3: + Qok = validate("electric quadrupole moment", match3.groups(), Qref, Qtol, line) + elif match4: + F1ok = validate("1-body force", match4.groups(), F1ref, F1tol, line) + elif match5: + FPok = validate("Pulay force", match5.groups(), FPref, FPtol, line) + elif match6: + F2ok = validate("2-body force", match6.groups(), F2ref, F2tol, line) + elif match7: + FNok = validate("nuclear repulsion force", match7.groups(), FNref, FNtol, line) + elif match8: + Fok = validate("HF force", match8.groups(), Fref, Ftol, line) + elif match9: + H1ok = validate("1-body hessian", match9.groups(), H1ref, H1tol, line) + elif match10: + HPok = validate("Pulay hessian", match10.groups(), HPref, HPtol, line) + elif match11: + H2ok = validate("2-body hessian", match11.groups(), H2ref, H2tol, line) + elif match12: + HNok = validate("nuclear repulsion hessian", match12.groups(), HNref, HNtol, line) + elif match13: + Hok = validate("HF hessian", match13.groups(), Href, Htol, line) + elif match14: + smuok = validate("spherical electric dipole moment", match14.groups(), smuref, smutol, line) + elif match15: + sQok = validate("spherical electric quadrupole moment", match15.groups(), sQref, sQtol, line) + else: + print(line,end="") + +if len(sys.argv) > 2: + instr.close() +ok = eok and muok and Qok and F1ok and FPok and F2ok and FNok and Fok and H1ok and HPok and H2ok and HNok and Hok and smuok and sQok +if not ok: sys.exit(1) + + diff --git a/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc b/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc new file mode 100644 index 000000000..3f95c006e --- /dev/null +++ b/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc @@ -0,0 +1,2538 @@ +/* + * Copyright (C) 2004-2021 Edward F. Valeev + * + * This file is part of Libint. + * + * Libint is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Libint is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Libint. If not, see . + * + */ + +// standard C++ headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Eigen matrix algebra library +#include +#include +#include + +// have BTAS library? +#ifdef LIBINT2_HAVE_BTAS +#include +#endif // LIBINT2_HAVE_BTAS + +// Libint Gaussian integrals library +#include +#include +#include +#include +#include +#if !LIBINT2_CONSTEXPR_STATICS +# include +#endif + +#if defined(_OPENMP) +#include +#endif + +/// to use precomputed shell pair data must decide on max precision a priori +const auto max_engine_precision = std::numeric_limits::epsilon() / 1e10; + +// use conservative screening method +constexpr auto screening_method = libint2::ScreeningMethod::SchwarzInf; + +// uncomment if want to report integral timings +// N.B. integral engine timings are controled in engine.h +#define REPORT_INTEGRAL_TIMINGS + +typedef Eigen::Matrix + Matrix; // import dense, dynamically sized Matrix type from Eigen; + // this is a matrix with row-major storage + // (http://en.wikipedia.org/wiki/Row-major_order) +// to meet the layout of the integrals returned by the Libint integral library +typedef Eigen::DiagonalMatrix + DiagonalMatrix; + +using libint2::Shell; +using libint2::Atom; +using libint2::BasisSet; +using libint2::Operator; +using libint2::BraKet; +using libint2::ScreeningMethod; + +std::vector read_geometry(const std::string& filename); +Matrix compute_soad(const std::vector& atoms); +// computes norm of shell-blocks of A +Matrix compute_shellblock_norm(const BasisSet& obs, const Matrix& A); + +template ::oper_params_type> +std::array::nopers> compute_1body_ints( + const BasisSet& obs, + OperatorParams oparams = + OperatorParams()); + +#if LIBINT2_DERIV_ONEBODY_ORDER +template +std::vector compute_1body_ints_deriv(unsigned deriv_order, + const BasisSet& obs, + const std::vector& atoms); +#endif // LIBINT2_DERIV_ONEBODY_ORDER + +template +Matrix compute_schwarz_ints( + const BasisSet& bs1, const BasisSet& bs2 = BasisSet(), + bool use_2norm = false, // use infty norm by default + typename libint2::operator_traits::oper_params_type params = + libint2::operator_traits::default_params()); +Matrix compute_do_ints(const BasisSet& bs1, const BasisSet& bs2 = BasisSet(), + bool use_2norm = false // use infty norm by default + ); + +using shellpair_list_t = std::unordered_map>; +shellpair_list_t obs_shellpair_list; // shellpair list for OBS +using shellpair_data_t = std::vector>>; // in same order as shellpair_list_t +shellpair_data_t obs_shellpair_data; // shellpair data for OBS + +/// computes non-negligible shell pair list; shells \c i and \c j form a +/// non-negligible +/// pair if they share a center or the Frobenius norm of their overlap is +/// greater than threshold +std::tuple +compute_shellpairs(const BasisSet& bs1, + const BasisSet& bs2 = BasisSet(), + double threshold = 1e-12); + +Matrix compute_2body_fock( + const BasisSet& obs, const Matrix& D, + double precision = std::numeric_limits< + double>::epsilon(), // discard contributions smaller than this + const Matrix& Schwarz = Matrix() // K_ij = sqrt(||(ij|ij)||_\infty); if + // empty, do not Schwarz screen + ); +// an Fock builder that can accept densities expressed a separate basis +Matrix compute_2body_fock_general( + const BasisSet& obs, const Matrix& D, const BasisSet& D_bs, + bool D_is_sheldiagonal = false, // set D_is_shelldiagonal if doing SOAD + double precision = std::numeric_limits< + double>::epsilon() // discard contributions smaller than this + ); + +#if LIBINT2_DERIV_ERI_ORDER +template +std::vector compute_2body_fock_deriv( + const BasisSet& obs, const std::vector& atoms, + const Matrix& D, + double precision = std::numeric_limits< + double>::epsilon(), // discard contributions smaller than this + const Matrix& Schwarz = Matrix() // K_ij = sqrt(||(ij|ij)||_\infty); if + // empty, do not Schwarz screen + ); +#endif // LIBINT2_DERIV_ERI_ORDER + +// returns {X,X^{-1},S_condition_number_after_conditioning}, where +// X is the generalized square-root-inverse such that X.transpose() * S * X = I +// columns of Xinv is the basis conditioned such that +// the condition number of its metric (Xinv.transpose . Xinv) < +// S_condition_number_threshold +std::tuple conditioning_orthogonalizer( + const Matrix& S, double S_condition_number_threshold); + +#ifdef LIBINT2_HAVE_BTAS +#define HAVE_DENSITY_FITTING 1 +struct DFFockEngine { + const BasisSet& obs; + const BasisSet& dfbs; + DFFockEngine(const BasisSet& _obs, const BasisSet& _dfbs) + : obs(_obs), dfbs(_dfbs) {} + + typedef btas::RangeNd> Range3d; + typedef btas::Tensor Tensor3d; + Tensor3d xyK; + + // a DF-based builder, using coefficients of occupied MOs + Matrix compute_2body_fock_dfC(const Matrix& Cocc); +}; +#endif // HAVE_DENSITY_FITTING + +namespace libint2 { +int nthreads; + +/// fires off \c nthreads instances of lambda in parallel +template +void parallel_do(Lambda& lambda) { +#ifdef _OPENMP +#pragma omp parallel + { + auto thread_id = omp_get_thread_num(); + lambda(thread_id); + } +#else // use C++11 threads + std::vector threads; + for (int thread_id = 0; thread_id != libint2::nthreads; ++thread_id) { + if (thread_id != nthreads - 1) + threads.push_back(std::thread(lambda, thread_id)); + else + lambda(thread_id); + } // threads_id + for (int thread_id = 0; thread_id < nthreads - 1; ++thread_id) + threads[thread_id].join(); +#endif +} +} + +int main(int argc, char* argv[]) { + using std::cout; + using std::cerr; + using std::endl; + + try { + /*** =========================== ***/ + /*** initialize molecule ***/ + /*** =========================== ***/ + + // read geometry from a file; by default read from h2o.xyz, else take + // filename (.xyz) from the command line + const auto filename = (argc > 1) ? argv[1] : "h2o.xyz"; + const auto basisname = (argc > 2) ? argv[2] : "aug-cc-pVDZ"; + bool do_density_fitting = false; +#ifdef HAVE_DENSITY_FITTING + do_density_fitting = (argc > 3); + const auto dfbasisname = do_density_fitting ? argv[3] : ""; +#endif + std::vector atoms = read_geometry(filename); + + // set up thread pool + { + using libint2::nthreads; + auto nthreads_cstr = getenv("LIBINT_NUM_THREADS"); + nthreads = 1; + if (nthreads_cstr && strcmp(nthreads_cstr, "")) { + std::istringstream iss(nthreads_cstr); + iss >> nthreads; + if (nthreads > 1 << 16 || nthreads <= 0) nthreads = 1; + } +#if defined(_OPENMP) + omp_set_num_threads(nthreads); +#endif + std::cout << "Will scale over " << nthreads +#if defined(_OPENMP) + << " OpenMP" +#else + << " C++11" +#endif + << " threads" << std::endl; + } + + // count the number of electrons + auto nelectron = 0; + for (auto i = 0; i < atoms.size(); ++i) nelectron += atoms[i].atomic_number; + const auto ndocc = nelectron / 2; + cout << "# of electrons = " << nelectron << endl; + + // compute the nuclear repulsion energy + auto enuc = 0.0; + for (auto i = 0; i < atoms.size(); i++) + for (auto j = i + 1; j < atoms.size(); j++) { + auto xij = atoms[i].x - atoms[j].x; + auto yij = atoms[i].y - atoms[j].y; + auto zij = atoms[i].z - atoms[j].z; + auto r2 = xij * xij + yij * yij + zij * zij; + auto r = sqrt(r2); + enuc += atoms[i].atomic_number * atoms[j].atomic_number / r; + } + cout << "Nuclear repulsion energy = " << std::setprecision(15) << enuc + << endl; + + libint2::Shell::do_enforce_unit_normalization(false); + + cout << "Atomic Cartesian coordinates (a.u.):" << endl; + for (const auto& a : atoms) + std::cout << a.atomic_number << " " << a.x << " " << a.y << " " << a.z + << std::endl; + + BasisSet obs(basisname, atoms); + cout << "orbital basis set rank = " << obs.nbf() << endl; + +#ifdef HAVE_DENSITY_FITTING + BasisSet dfbs; + if (do_density_fitting) { + dfbs = BasisSet(dfbasisname, atoms); + cout << "density-fitting basis set rank = " << dfbs.nbf() << endl; + } +#endif // HAVE_DENSITY_FITTING + + /*** =========================== ***/ + /*** compute 1-e integrals ***/ + /*** =========================== ***/ + + // initializes the Libint integrals library ... now ready to compute + libint2::initialize(); + + // compute OBS non-negligible shell-pair list + { + const auto tstart = std::chrono::high_resolution_clock::now(); + std::tie(obs_shellpair_list, obs_shellpair_data) = compute_shellpairs(obs); + size_t nsp = 0; + for (auto& sp : obs_shellpair_list) { + nsp += sp.second.size(); + } + const auto tstop = std::chrono::high_resolution_clock::now(); + const std::chrono::duration time_elapsed = tstop - tstart; + std::cout << "computed shell-pair data in " << time_elapsed.count() << " seconds: # of {all,non-negligible} shell-pairs = {" + << obs.size() * (obs.size() + 1) / 2 << "," << nsp << "}" + << std::endl; + } + + // compute one-body integrals + auto S = compute_1body_ints(obs)[0]; + auto T = compute_1body_ints(obs)[0]; + auto V = compute_1body_ints(obs, libint2::make_point_charges(atoms))[0]; + Matrix H = T + V; + T.resize(0, 0); + V.resize(0, 0); + + // compute orthogonalizer X such that X.transpose() . S . X = I + Matrix X, Xinv; + double XtX_condition_number; // condition number of "re-conditioned" + // overlap obtained as Xinv.transpose() . Xinv + // one should think of columns of Xinv as the conditioned basis + // Re: name ... cond # (Xinv.transpose() . Xinv) = cond # (X.transpose() . + // X) + // by default assume can manage to compute with condition number of S <= + // 1/eps + // this is probably too optimistic, but in well-behaved cases even 10^11 is + // OK + double S_condition_number_threshold = + 1.0 / std::numeric_limits::epsilon(); + std::tie(X, Xinv, XtX_condition_number) = + conditioning_orthogonalizer(S, S_condition_number_threshold); + + Matrix D; + Matrix C; + Matrix C_occ; + Matrix evals; + { // use SOAD as the guess density + const auto tstart = std::chrono::high_resolution_clock::now(); + + auto D_minbs = compute_soad(atoms); // compute guess in minimal basis + BasisSet minbs("STO-3G", atoms); + if (minbs == obs) + D = D_minbs; + else { // if basis != minimal basis, map non-representable SOAD guess + // into the AO basis + // by diagonalizing a Fock matrix + std::cout << "projecting SOAD into AO basis ... "; + auto F = H; + F += compute_2body_fock_general( + obs, D_minbs, minbs, true /* SOAD_D_is_shelldiagonal */, + std::numeric_limits::epsilon() // this is cheap, no reason + // to be cheaper + ); + + // solve F C = e S C by (conditioned) transformation to F' C' = e C', + // where + // F' = X.transpose() . F . X; the original C is obtained as C = X . C' + Eigen::SelfAdjointEigenSolver eig_solver(X.transpose() * F * X); + C = X * eig_solver.eigenvectors(); + + // compute density, D = C(occ) . C(occ)T + C_occ = C.leftCols(ndocc); + D = C_occ * C_occ.transpose(); + + const auto tstop = std::chrono::high_resolution_clock::now(); + const std::chrono::duration time_elapsed = tstop - tstart; + std::cout << "done (" << time_elapsed.count() << " s)" << std::endl; + } + } + + // pre-compute data for Schwarz bounds + auto K = compute_schwarz_ints<>(obs); + +// prepare for density fitting +#ifdef HAVE_DENSITY_FITTING + std::unique_ptr dffockengine( + do_density_fitting ? new DFFockEngine(obs, dfbs) : nullptr); +#endif // HAVE_DENSITY_FITTING + + /*** =========================== ***/ + /*** SCF loop ***/ + /*** =========================== ***/ + + const auto maxiter = 100; + const auto conv = 1e-12; + auto iter = 0; + auto rms_error = 1.0; + auto ediff_rel = 0.0; + auto ehf = 0.0; + auto n2 = D.cols() * D.rows(); + libint2::DIIS diis(2); // start DIIS on second iteration + + // prepare for incremental Fock build ... + Matrix D_diff = D; + Matrix F = H; + bool reset_incremental_fock_formation = false; + bool incremental_Fbuild_started = false; + double start_incremental_F_threshold = 1e-5; + double next_reset_threshold = 0.0; + size_t last_reset_iteration = 0; + // ... unless doing DF, then use MO coefficients, hence not "incremental" + if (do_density_fitting) start_incremental_F_threshold = 0.0; + + do { + const auto tstart = std::chrono::high_resolution_clock::now(); + ++iter; + + // Last iteration's energy and density + auto ehf_last = ehf; + Matrix D_last = D; + + if (not incremental_Fbuild_started && + rms_error < start_incremental_F_threshold) { + incremental_Fbuild_started = true; + reset_incremental_fock_formation = false; + last_reset_iteration = iter - 1; + next_reset_threshold = rms_error / 1e1; + std::cout << "== started incremental fock build" << std::endl; + } + if (reset_incremental_fock_formation || not incremental_Fbuild_started) { + F = H; + D_diff = D; + } + if (reset_incremental_fock_formation && incremental_Fbuild_started) { + reset_incremental_fock_formation = false; + last_reset_iteration = iter; + next_reset_threshold = rms_error / 1e1; + std::cout << "== reset incremental fock build" << std::endl; + } + + // build a new Fock matrix + if (not do_density_fitting) { + // totally empirical precision variation, involves the condition number + const auto precision_F = std::min( + std::min(1e-3 / XtX_condition_number, 1e-7), + std::max(rms_error / 1e4, std::numeric_limits::epsilon())); + F += compute_2body_fock(obs, D_diff, precision_F, K); + } +#if HAVE_DENSITY_FITTING + else { // do DF + F = H + dffockengine->compute_2body_fock_dfC(C_occ); + } +#else + else { + assert(false); + } // do_density_fitting is true but HAVE_DENSITY_FITTING is not defined! + // should not happen +#endif // HAVE_DENSITY_FITTING + + // compute HF energy with the non-extrapolated Fock matrix + ehf = D.cwiseProduct(H + F).sum(); + ediff_rel = std::abs((ehf - ehf_last) / ehf); + + // compute SCF error + Matrix FD_comm = F * D * S - S * D * F; + rms_error = FD_comm.norm() / n2; + if (rms_error < next_reset_threshold || iter - last_reset_iteration >= 8) + reset_incremental_fock_formation = true; + + // DIIS extrapolate F + Matrix F_diis = F; // extrapolated F cannot be used in incremental Fock + // build; only used to produce the density + // make a copy of the unextrapolated matrix + diis.extrapolate(F_diis, FD_comm); + + // solve F C = e S C by (conditioned) transformation to F' C' = e C', + // where + // F' = X.transpose() . F . X; the original C is obtained as C = X . C' + Eigen::SelfAdjointEigenSolver eig_solver(X.transpose() * F_diis * + X); + evals = eig_solver.eigenvalues(); + C = X * eig_solver.eigenvectors(); + + // compute density, D = C(occ) . C(occ)T + C_occ = C.leftCols(ndocc); + D = C_occ * C_occ.transpose(); + D_diff = D - D_last; + + const auto tstop = std::chrono::high_resolution_clock::now(); + const std::chrono::duration time_elapsed = tstop - tstart; + + if (iter == 1) + std::cout << "\n\nIter E(HF) D(E)/E " + "RMS([F,D])/nn Time(s)\n"; + printf(" %02d %20.12f %20.12e %20.12e %10.5lf\n", iter, ehf + enuc, + ediff_rel, rms_error, time_elapsed.count()); + + } while (((ediff_rel > conv) || (rms_error > conv)) && (iter < maxiter)); + + printf("** Hartree-Fock energy = %20.12f\n", ehf + enuc); + + // dump orbs to a molden file + { + Eigen::VectorXd occs(C.cols()); + occs.setZero(); + for(size_t o=0; o!=ndocc; ++o) + occs[o] = 2.0; + + libint2::molden::Export xport(atoms, obs, C, occs, evals); + std::ofstream molden_file("hf++.molden"); + xport.write(molden_file); + } + + auto Mu = compute_1body_ints(obs); + + std::array mu; + for (int xyz = 0; xyz != 3; ++xyz) + mu[xyz] = -2 * + D.cwiseProduct(Mu[xyz + 1]) + .sum(); // 2 = alpha + beta, -1 = electron charge + std::cout << "** edipole = "; + std::copy(mu.begin(), mu.end(), + std::ostream_iterator(std::cout, " ")); + std::cout << std::endl; + + std::array qu; + for (int k = 0; k != 6; ++k) + qu[k] = -2 * + D.cwiseProduct(Mu[k + 4]) + .sum(); // 2 = alpha + beta, -1 = electron charge + std::cout << "** equadrupole = "; + std::copy(qu.begin(), qu.end(), + std::ostream_iterator(std::cout, " ")); + std::cout << std::endl; + + std::array oct; + for (int k = 0; k != 10; ++k) + oct[k] = -2 * + D.cwiseProduct(Mu[k + 10]) + .sum(); // 2 = alpha + beta, -1 = electron charge +// std::cout << "** eoctupole = "; +// std::copy(oct.begin(), oct.end(), +// std::ostream_iterator(std::cout, " ")); +// std::cout << std::endl; + + // use spherical moments + auto SMu = compute_1body_ints(obs); + { +#if MULTIPOLE_MAX_ORDER > 0 + std::array mu; + for (int xyz = 0; xyz != 3; ++xyz) + mu[xyz] = -2 * + D.cwiseProduct(SMu[xyz + 1]) + .sum(); // 2 = alpha + beta, -1 = electron charge + std::cout << "** sph edipole = "; + std::copy(mu.begin(), mu.end(), + std::ostream_iterator(std::cout, " ")); + std::cout << std::endl; +#endif +#if MULTIPOLE_MAX_ORDER > 1 + std::array qu; + for (int k = 0; k != 5; ++k) + qu[k] = -2 * + D.cwiseProduct(SMu[k + 4]) + .sum(); // 2 = alpha + beta, -1 = electron charge + std::cout << "** sph equadrupole = "; + std::copy(qu.begin(), qu.end(), + std::ostream_iterator(std::cout, " ")); + std::cout << std::endl; +#endif +#if MULTIPOLE_MAX_ORDER > 2 + std::array oct; + for (int k = 0; k != 7; ++k) + oct[k] = -2 * + D.cwiseProduct(SMu[k + 9]) + .sum(); // 2 = alpha + beta, -1 = electron charge +// std::cout << "** sph eoctupole = "; +// std::copy(oct.begin(), oct.end(), +// std::ostream_iterator(std::cout, " ")); +// std::cout << std::endl; + + // recompute C^3_0 from xxz, yyz, and zzz + std::cout << "C^3_0 - (2zzz - 3xxz - 3yyz)/12:\n" << ((2.*Mu[19] - 3.*Mu[12] - 3.*Mu[17])/12 - SMu[12]).norm() << std::endl; +#endif + } + + { // compute force +#if LIBINT2_DERIV_ONEBODY_ORDER + // compute 1-e forces + Matrix F1 = Matrix::Zero(atoms.size(), 3); + Matrix F_Pulay = Matrix::Zero(atoms.size(), 3); + ////////// + // one-body contributions to the forces + ////////// + auto T1 = compute_1body_ints_deriv(1, obs, atoms); + auto V1 = compute_1body_ints_deriv(1, obs, atoms); + for (auto atom = 0, i = 0; atom != atoms.size(); ++atom) { + for (auto xyz = 0; xyz != 3; ++xyz, ++i) { + auto force = 2 * (T1[i] + V1[i]).cwiseProduct(D).sum(); + F1(atom, xyz) += force; + } + } + + ////////// + // Pulay force + ////////// + // orbital energy density + DiagonalMatrix evals_occ(evals.topRows(ndocc)); + Matrix W = C_occ * evals_occ * C_occ.transpose(); + auto S1 = compute_1body_ints_deriv(1, obs, atoms); + for (auto atom = 0, i = 0; atom != atoms.size(); ++atom) { + for (auto xyz = 0; xyz != 3; ++xyz, ++i) { + auto force = 2 * S1[i].cwiseProduct(W).sum(); + F_Pulay(atom, xyz) -= force; + } + } + + std::cout << "** 1-body forces = "; + for (int atom = 0; atom != atoms.size(); ++atom) + for (int xyz = 0; xyz != 3; ++xyz) std::cout << F1(atom, xyz) << " "; + std::cout << std::endl; + std::cout << "** Pulay forces = "; + for (int atom = 0; atom != atoms.size(); ++atom) + for (int xyz = 0; xyz != 3; ++xyz) + std::cout << F_Pulay(atom, xyz) << " "; + std::cout << std::endl; +#endif // LIBINT2_DERIV_ONEBODY_ORDER + +#if LIBINT2_DERIV_ERI_ORDER + // compute 2-e forces + Matrix F2 = Matrix::Zero(atoms.size(), 3); + + ////////// + // two-body contributions to the forces + ////////// + auto G1 = compute_2body_fock_deriv<1>(obs, atoms, D); + for (auto atom = 0, i = 0; atom != atoms.size(); ++atom) { + for (auto xyz = 0; xyz != 3; ++xyz, ++i) { + // identity prefactor since E(HF) = trace(H + F, D) = trace(2H + G, D) + auto force = G1[i].cwiseProduct(D).sum(); + F2(atom, xyz) += force; + } + } + + std::cout << "** 2-body forces = "; + for (int atom = 0; atom != atoms.size(); ++atom) + for (int xyz = 0; xyz != 3; ++xyz) std::cout << F2(atom, xyz) << " "; + std::cout << std::endl; +#endif + +// if support 1-e and 2-e derivatives compute nuclear repulsion force and the +// total force +#if LIBINT2_DERIV_ONEBODY_ORDER && LIBINT2_DERIV_ERI_ORDER + // compute nuclear repulsion forces + Matrix FN = Matrix::Zero(atoms.size(), 3); + ////////// + // nuclear repulsion contribution to the forces + ////////// + for (auto a1 = 1; a1 != atoms.size(); ++a1) { + const auto& atom1 = atoms[a1]; + for (auto a2 = 0; a2 < a1; ++a2) { + const auto& atom2 = atoms[a2]; + + auto x12 = atom1.x - atom2.x; + auto y12 = atom1.y - atom2.y; + auto z12 = atom1.z - atom2.z; + auto r12_2 = x12 * x12 + y12 * y12 + z12 * z12; + auto r12 = sqrt(r12_2); + auto r12_3 = r12 * r12_2; + + auto z1z2_over_r12_3 = + atom1.atomic_number * atom2.atomic_number / r12_3; + + auto fx = -x12 * z1z2_over_r12_3; + auto fy = -y12 * z1z2_over_r12_3; + auto fz = -z12 * z1z2_over_r12_3; + FN(a1, 0) += fx; + FN(a1, 1) += fy; + FN(a1, 2) += fz; + FN(a2, 0) -= fx; + FN(a2, 1) -= fy; + FN(a2, 2) -= fz; + } + } + + std::cout << "** nuclear repulsion forces = "; + for (int atom = 0; atom != atoms.size(); ++atom) + for (int xyz = 0; xyz != 3; ++xyz) std::cout << FN(atom, xyz) << " "; + std::cout << std::endl; + + auto F = F1 + F_Pulay + F2 + FN; + std::cout << "** Hartree-Fock forces = "; + for (int atom = 0; atom != atoms.size(); ++atom) + for (int xyz = 0; xyz != 3; ++xyz) std::cout << F(atom, xyz) << " "; + std::cout << std::endl; +#endif + } + + { // compute hessian + const auto ncoords = 3 * atoms.size(); + // # of elems in upper triangle + const auto nelem = ncoords * (ncoords+1) / 2; +#if LIBINT2_DERIV_ONEBODY_ORDER > 1 + // compute 1-e hessian + Matrix H1 = Matrix::Zero(ncoords, ncoords); + Matrix H_Pulay = Matrix::Zero(ncoords, ncoords); + ////////// + // one-body contributions to the hessian + ////////// + auto T2 = compute_1body_ints_deriv(2, obs, atoms); + auto V2 = compute_1body_ints_deriv(2, obs, atoms); + for (auto row = 0, i = 0; row != ncoords; ++row) { + for (auto col = row; col != ncoords; ++col, ++i) { + auto hess = 2 * (T2[i] + V2[i]).cwiseProduct(D).sum(); + H1(row, col) += hess; + } + } + + ////////// + // Pulay hessian + ////////// + // orbital energy density + DiagonalMatrix evals_occ(evals.topRows(ndocc)); + Matrix W = C_occ * evals_occ * C_occ.transpose(); + auto S2 = compute_1body_ints_deriv(2, obs, atoms); + for (auto row = 0, i = 0; row != ncoords; ++row) { + for (auto col = row; col != ncoords; ++col, ++i) { + auto hess = 2 * S2[i].cwiseProduct(W).sum(); + H_Pulay(row, col) -= hess; + } + } + + std::cout << "** 1-body hessian = "; + for (auto row = 0, i = 0; row != ncoords; ++row) { + for (auto col = row; col != ncoords; ++col) { + std::cout << H1(row, col) << " "; + } + } + std::cout << std::endl; + + std::cout << "** Pulay hessian = "; + for (auto row = 0, i = 0; row != ncoords; ++row) { + for (auto col = row; col != ncoords; ++col) { + std::cout << H_Pulay(row, col) << " "; + } + } + std::cout << std::endl; +#endif // LIBINT2_DERIV_ONEBODY_ORDER > 1 + +#if LIBINT2_DERIV_ERI_ORDER > 1 + // compute 2-e forces + Matrix H2 = Matrix::Zero(ncoords, ncoords); + + ////////// + // two-body contributions to the forces + ////////// + auto G2 = compute_2body_fock_deriv<2>(obs, atoms, D); + for (auto row = 0, i = 0; row != ncoords; ++row) { + for (auto col = row; col != ncoords; ++col, ++i) { + // identity prefactor since E(HF) = trace(H + F, D) = trace(2H + G, D) + auto hess = G2[i].cwiseProduct(D).sum(); + H2(row, col) += hess; + } + } + + std::cout << "** 2-body hessian = "; + for (auto row = 0, i = 0; row != ncoords; ++row) { + for (auto col = row; col != ncoords; ++col) { + std::cout << H2(row, col) << " "; + } + } + std::cout << std::endl; +#endif + +// if support 1-e and 2-e 2nd derivatives compute nuclear repulsion hessian and +// the total hessian +#if LIBINT2_DERIV_ONEBODY_ORDER > 1 && LIBINT2_DERIV_ERI_ORDER > 1 + // compute nuclear repulsion hessian + // NB only the upper triangle is computed!!! + Matrix HN = Matrix::Zero(ncoords, ncoords); + + ////////// + // nuclear repulsion contribution to the hessian + ////////// + for (auto a1 = 1; a1 != atoms.size(); ++a1) { + const auto& atom1 = atoms[a1]; + for (auto a2 = 0; a2 < a1; ++a2) { + const auto& atom2 = atoms[a2]; + + auto x12 = atom1.x - atom2.x; + auto y12 = atom1.y - atom2.y; + auto z12 = atom1.z - atom2.z; + auto x12_2 = x12 * x12; + auto y12_2 = y12 * y12; + auto z12_2 = z12 * z12; + auto r12_2 = x12 * x12 + y12 * y12 + z12 * z12; + auto r12 = sqrt(r12_2); + auto r12_5 = r12 * r12_2 * r12_2; + + auto z1z2_over_r12_5 = + atom1.atomic_number * atom2.atomic_number / r12_5; + + HN(3*a1 + 0, 3*a1 + 0) += z1z2_over_r12_5 * (3*x12_2 - r12_2); + HN(3*a1 + 1, 3*a1 + 1) += z1z2_over_r12_5 * (3*y12_2 - r12_2); + HN(3*a1 + 2, 3*a1 + 2) += z1z2_over_r12_5 * (3*z12_2 - r12_2); + HN(3*a1 + 0, 3*a1 + 1) += z1z2_over_r12_5 * (3*x12*y12); + HN(3*a1 + 0, 3*a1 + 2) += z1z2_over_r12_5 * (3*x12*z12); + HN(3*a1 + 1, 3*a1 + 2) += z1z2_over_r12_5 * (3*y12*z12); + + HN(3*a2 + 0, 3*a2 + 0) += z1z2_over_r12_5 * (3*x12_2 - r12_2); + HN(3*a2 + 1, 3*a2 + 1) += z1z2_over_r12_5 * (3*y12_2 - r12_2); + HN(3*a2 + 2, 3*a2 + 2) += z1z2_over_r12_5 * (3*z12_2 - r12_2); + HN(3*a2 + 0, 3*a2 + 1) += z1z2_over_r12_5 * (3*x12*y12); + HN(3*a2 + 0, 3*a2 + 2) += z1z2_over_r12_5 * (3*x12*z12); + HN(3*a2 + 1, 3*a2 + 2) += z1z2_over_r12_5 * (3*y12*z12); + + HN(3*a2 + 0, 3*a1 + 0) -= z1z2_over_r12_5 * (3*x12_2 - r12_2); + HN(3*a2 + 1, 3*a1 + 1) -= z1z2_over_r12_5 * (3*y12_2 - r12_2); + HN(3*a2 + 2, 3*a1 + 2) -= z1z2_over_r12_5 * (3*z12_2 - r12_2); + HN(3*a2 + 1, 3*a1 + 0) -= z1z2_over_r12_5 * (3*y12*x12); + HN(3*a2 + 2, 3*a1 + 0) -= z1z2_over_r12_5 * (3*z12*x12); + HN(3*a2 + 2, 3*a1 + 1) -= z1z2_over_r12_5 * (3*z12*y12); + HN(3*a2 + 0, 3*a1 + 1) -= z1z2_over_r12_5 * (3*x12*y12); + HN(3*a2 + 0, 3*a1 + 2) -= z1z2_over_r12_5 * (3*x12*z12); + HN(3*a2 + 1, 3*a1 + 2) -= z1z2_over_r12_5 * (3*y12*z12); + } + } + + std::cout << "** nuclear repulsion hessian = "; + for (auto row = 0, i = 0; row != ncoords; ++row) { + for (auto col = row; col != ncoords; ++col) { + std::cout << HN(row, col) << " "; + } + } + std::cout << std::endl; + + auto H = H1 + H_Pulay + H2 + HN; + std::cout << "** Hartree-Fock hessian = "; + for (auto row = 0, i = 0; row != ncoords; ++row) { + for (auto col = row; col != ncoords; ++col) { + std::cout << H(row, col) << " "; + } + } + std::cout << std::endl; +#endif + } + + libint2::finalize(); // done with libint + + } // end of try block; if any exceptions occurred, report them and exit + // cleanly + + catch (const char* ex) { + cerr << "caught exception: " << ex << endl; + return 1; + } catch (std::string& ex) { + cerr << "caught exception: " << ex << endl; + return 1; + } catch (std::exception& ex) { + cerr << ex.what() << endl; + return 1; + } catch (...) { + cerr << "caught unknown exception\n"; + return 1; + } + + return 0; +} + +std::vector read_geometry(const std::string& filename) { + std::cout << "Will read geometry from " << filename << std::endl; + std::ifstream is(filename); + if (not is.good()) { + char errmsg[256] = "Could not open file "; + strncpy(errmsg + 20, filename.c_str(), 235); + errmsg[255] = '\0'; + throw std::runtime_error(errmsg); + } + + // to prepare for MPI parallelization, we will read the entire file into a + // string that can be + // broadcast to everyone, then converted to an std::istringstream object that + // can be used just like std::ifstream + std::ostringstream oss; + oss << is.rdbuf(); + // use ss.str() to get the entire contents of the file as an std::string + // broadcast + // then make an std::istringstream in each process + std::istringstream iss(oss.str()); + + // check the extension: if .xyz, assume the standard XYZ format, otherwise + // throw an exception + if (filename.rfind(".xyz") != std::string::npos) + return libint2::read_dotxyz(iss); + else + throw "only .xyz files are accepted"; +} + +// computes Superposition-Of-Atomic-Densities guess for the molecular density +// matrix +// in minimal basis; occupies subshells by smearing electrons evenly over the +// orbitals +Matrix compute_soad(const std::vector& atoms) { + // compute number of atomic orbitals + size_t nao = 0; + for (const auto& atom : atoms) { + const auto Z = atom.atomic_number; + nao += libint2::sto3g_num_ao(Z); + } + + // compute the minimal basis density + Matrix D = Matrix::Zero(nao, nao); + size_t ao_offset = 0; // first AO of this atom + for (const auto& atom : atoms) { + const auto Z = atom.atomic_number; + const auto& occvec = libint2::sto3g_ao_occupation_vector(Z); + for(const auto& occ: occvec) { + D(ao_offset, ao_offset) = occ; + ++ao_offset; + } + } + + return D * 0.5; // we use densities normalized to # of electrons/2 +} + +Matrix compute_shellblock_norm(const BasisSet& obs, const Matrix& A) { + const auto nsh = obs.size(); + Matrix Ash(nsh, nsh); + + auto shell2bf = obs.shell2bf(); + for (size_t s1 = 0; s1 != nsh; ++s1) { + const auto& s1_first = shell2bf[s1]; + const auto& s1_size = obs[s1].size(); + for (size_t s2 = 0; s2 != nsh; ++s2) { + const auto& s2_first = shell2bf[s2]; + const auto& s2_size = obs[s2].size(); + + Ash(s1, s2) = A.block(s1_first, s2_first, s1_size, s2_size) + .lpNorm(); + } + } + + return Ash; +} + +template +std::array::nopers> compute_1body_ints( + const BasisSet& obs, OperatorParams oparams) { + const auto n = obs.nbf(); + const auto nshells = obs.size(); + using libint2::nthreads; + typedef std::array::nopers> + result_type; + const unsigned int nopers = libint2::operator_traits::nopers; + result_type result; + for (auto& r : result) r = Matrix::Zero(n, n); + + // construct the 1-body integrals engine + std::vector engines(nthreads); + engines[0] = libint2::Engine(obtype, obs.max_nprim(), obs.max_l(), 0); + // pass operator params to the engine, e.g. + // nuclear attraction ints engine needs to know where the charges sit ... + // the nuclei are charges in this case; in QM/MM there will also be classical + // charges + engines[0].set_params(oparams); + for (size_t i = 1; i != nthreads; ++i) { + engines[i] = engines[0]; + } + + auto shell2bf = obs.shell2bf(); + + auto compute = [&](int thread_id) { + + const auto& buf = engines[thread_id].results(); + + // loop over unique shell pairs, {s1,s2} such that s1 >= s2 + // this is due to the permutational symmetry of the real integrals over + // Hermitian operators: (1|2) = (2|1) + for (auto s1 = 0l, s12 = 0l; s1 != nshells; ++s1) { + auto bf1 = shell2bf[s1]; // first basis function in this shell + auto n1 = obs[s1].size(); + + auto s1_offset = s1 * (s1+1) / 2; + for (auto s2: obs_shellpair_list[s1]) { + auto s12 = s1_offset + s2; + if (s12 % nthreads != thread_id) continue; + + auto bf2 = shell2bf[s2]; + auto n2 = obs[s2].size(); + + auto n12 = n1 * n2; + + // compute shell pair; return is the pointer to the buffer + engines[thread_id].compute(obs[s1], obs[s2]); + + for (unsigned int op = 0; op != nopers; ++op) { + // "map" buffer to a const Eigen Matrix, and copy it to the + // corresponding blocks of the result + Eigen::Map buf_mat(buf[op], n1, n2); + result[op].block(bf1, bf2, n1, n2) = buf_mat; + if (s1 != s2) // if s1 >= s2, copy {s1,s2} to the corresponding + // {s2,s1} block, note the transpose! + result[op].block(bf2, bf1, n2, n1) = buf_mat.transpose(); + } + } + } + }; // compute lambda + + libint2::parallel_do(compute); + + return result; +} + +#if LIBINT2_DERIV_ONEBODY_ORDER +template +std::vector compute_1body_ints_deriv(unsigned deriv_order, + const BasisSet& obs, + const std::vector& atoms) { + using libint2::nthreads; + const auto n = obs.nbf(); + const auto nshells = obs.size(); + constexpr auto nopers = libint2::operator_traits::nopers; + const auto nresults = + nopers * libint2::num_geometrical_derivatives(atoms.size(), deriv_order); + typedef std::vector result_type; + result_type result(nresults); + for (auto& r : result) r = Matrix::Zero(n, n); + + // construct the 1-body integrals engine + std::vector engines(nthreads); + engines[0] = + libint2::Engine(obtype, obs.max_nprim(), obs.max_l(), deriv_order); + // nuclear attraction ints engine needs to know where the charges sit ... + // the nuclei are charges in this case; in QM/MM there will also be classical + // charges + if (obtype == Operator::nuclear) { + std::vector>> q; + for (const auto& atom : atoms) { + q.push_back({static_cast(atom.atomic_number), + {{atom.x, atom.y, atom.z}}}); + } + engines[0].set_params(q); + } + for (size_t i = 1; i != nthreads; ++i) { + engines[i] = engines[0]; + } + + auto shell2bf = obs.shell2bf(); + auto shell2atom = obs.shell2atom(atoms); + + const auto natoms = atoms.size(); + const auto two_times_ncoords = 6*natoms; + const auto nderivcenters_shset = + 2 + ((obtype == Operator::nuclear) ? natoms : 0); + + auto compute = [&](int thread_id) { + + const auto& buf = engines[thread_id].results(); + + // loop over unique shell pairs, {s1,s2} such that s1 >= s2 + // this is due to the permutational symmetry of the real integrals over + // Hermitian operators: (1|2) = (2|1) + for (auto s1 = 0l, s12 = 0l; s1 != nshells; ++s1) { + auto bf1 = shell2bf[s1]; // first basis function in this shell + auto n1 = obs[s1].size(); + auto atom1 = shell2atom[s1]; + assert(atom1 != -1); + + auto s1_offset = s1 * (s1+1) / 2; + for (auto s2: obs_shellpair_list[s1]) { + auto s12 = s1_offset + s2; + if (s12 % nthreads != thread_id) continue; + + auto bf2 = shell2bf[s2]; + auto n2 = obs[s2].size(); + auto atom2 = shell2atom[s2]; + + auto n12 = n1 * n2; + + // compute shell pair; return is the pointer to the buffer + engines[thread_id].compute(obs[s1], obs[s2]); + + // "copy" lambda copies shell set \c idx to the operator matrix with + // index \c op + auto add_shellset_to_dest = [&](std::size_t op, std::size_t idx, + double scale = 1.0) { + // "map" buffer to a const Eigen Matrix, and copy it to the + // corresponding blocks of the result + Eigen::Map buf_mat(buf[idx], n1, n2); + if (scale == 1.0) + result[op].block(bf1, bf2, n1, n2) += buf_mat; + else + result[op].block(bf1, bf2, n1, n2) += scale * buf_mat; + if (s1 != s2) { // if s1 >= s2, copy {s1,s2} to the corresponding + // {s2,s1} block, note the transpose! + if (scale == 1.0) + result[op].block(bf2, bf1, n2, n1) += buf_mat.transpose(); + else + result[op].block(bf2, bf1, n2, n1) += scale * buf_mat.transpose(); + } + }; + + switch (deriv_order) { + case 0: + for (std::size_t op = 0; op != nopers; ++op) { + add_shellset_to_dest(op, op); + } + break; + + // map deriv quanta for this shell pair to the overall deriv quanta + // + // easiest to explain with example: + // in sto-3g water shells 0 1 2 sit on atom 0, shells 3 and 4 on atoms + // 1 and 2 respectively + // each call to engine::compute for nuclear ints will return + // derivatives + // with respect to 15 coordinates, obtained as 3 (x,y,z) times 2 + 3 = + // 5 centers + // (2 centers on which shells sit + 3 nuclear charges) + // (for overlap, kinetic, and emultipole ints we there are only 6 + // coordinates + // since the operator is coordinate-independent, or derivatives with + // respect to + // the operator coordinates are not computed) + // + + case 1: { + std::size_t shellset_idx = 0; + for (auto c = 0; c != nderivcenters_shset; ++c) { + auto atom = (c == 0) ? atom1 : ((c == 1) ? atom2 : c - 2); + auto op_start = 3 * atom * nopers; + auto op_fence = op_start + nopers; + for (auto xyz = 0; xyz != 3; + ++xyz, op_start += nopers, op_fence += nopers) { + for (unsigned int op = op_start; op != op_fence; + ++op, ++shellset_idx) { + add_shellset_to_dest(op, shellset_idx); + } + } + } + } break; + + case 2: { + // + // must pay attention to symmetry when computing 2nd and higher-order derivs + // e.g. d2 (s1|s2) / dX dY involves several cases: + // 1. only s1 (or only s2) depends on X AND Y (i.e. X and Y refer to same atom) => + // d2 (s1|s2) / dX dY = (d2 s1 / dX dY | s2) + // 2. s1 depends on X only, s2 depends on Y only (or vice versa) => + // d2 (s1|s2) / dX dY = (d s1 / dX | d s2 / dY) + // 3. s1 AND s2 depend on X AND Y (i.e. X and Y refer to same atom) => + // case A: X != Y + // d2 (s1|s2) / dX dY = (d2 s1 / dX dY | s2) + (d s1 / dX | d s2 / dY) + // + (d s1 / dY | d s2 / dX) + (s1| d2 s2 / dX dY ) + // case B: X == Y + // d2 (s1|s2) / dX2 = (d2 s1 / dX2 | s2) + 2 (d s1 / dX | d s2 / dX) + // + (s1| d2 s2 / dX2 ) + + // computes upper triangle index + // n2 = matrix size times 2 + // i,j = (unordered) indices + auto upper_triangle_index = [](long n2, long i, long j) { + return std::min(i, j) * (n2 - std::min(i, j) - 1) / 2 + std::max(i, j); + }; + + // look over shellsets in the order in which they appear + std::size_t shellset_idx = 0; + for (auto c1 = 0; c1 != nderivcenters_shset; ++c1) { + auto a1 = (c1 == 0) ? atom1 : ((c1 == 1) ? atom2 : c1 - 2); + auto coord1 = 3 * a1; + for (auto xyz1 = 0; xyz1 != 3; ++xyz1, ++coord1) { + + for (auto c2 = c1; c2 != nderivcenters_shset; ++c2) { + auto a2 = (c2 == 0) ? atom1 : ((c2 == 1) ? atom2 : c2 - 2); + auto xyz2_start = (c1 == c2) ? xyz1 : 0; + auto coord2 = 3 * a2 + xyz2_start; + for (auto xyz2 = xyz2_start; xyz2 != 3; + ++xyz2, ++coord2) { + + double scale = (coord1 == coord2 && c1 != c2) ? 2.0 : 1.0; + + const auto coord12 = + upper_triangle_index(two_times_ncoords, coord1, coord2); + auto op_start = coord12 * nopers; + auto op_fence = op_start + nopers; + for (auto op = op_start; op != op_fence; + ++op, ++shellset_idx) { + add_shellset_to_dest(op, shellset_idx, scale); + } + } + } + } + } + } break; + + default: { + assert(false && "not yet implemented"); + + using ShellSetDerivIterator = + libint2::FixedOrderedIntegerPartitionIterator< + std::vector>; + ShellSetDerivIterator shellset_diter(deriv_order, + nderivcenters_shset); + while (shellset_diter) { + const auto& deriv = *shellset_diter; + } + } + } // copy shell block switch + + } // s2 <= s1 + } // s1 + }; // compute lambda + + libint2::parallel_do(compute); + + return result; +} +#endif + +template +Matrix compute_schwarz_ints( + const BasisSet& bs1, const BasisSet& _bs2, bool use_2norm, + typename libint2::operator_traits::oper_params_type params) { + const BasisSet& bs2 = (_bs2.empty() ? bs1 : _bs2); + const auto nsh1 = bs1.size(); + const auto nsh2 = bs2.size(); + const auto bs1_equiv_bs2 = (&bs1 == &bs2); + + Matrix K = Matrix::Zero(nsh1, nsh2); + + // construct the 2-electron repulsion integrals engine + using libint2::Engine; + using libint2::nthreads; + std::vector engines(nthreads); + + // !!! very important: cannot screen primitives in Schwarz computation !!! + auto epsilon = 0.; + engines[0] = Engine(Kernel, std::max(bs1.max_nprim(), bs2.max_nprim()), + std::max(bs1.max_l(), bs2.max_l()), 0, epsilon, params); + for (size_t i = 1; i != nthreads; ++i) { + engines[i] = engines[0]; + } + + std::cout << "computing Schwarz bound prerequisites (kernel=" << (int)Kernel + << ") ... "; + + libint2::Timers<1> timer; + timer.set_now_overhead(25); + timer.start(0); + + auto compute = [&](int thread_id) { + + const auto& buf = engines[thread_id].results(); + + // loop over permutationally-unique set of shells + for (auto s1 = 0l, s12 = 0l; s1 != nsh1; ++s1) { + auto n1 = bs1[s1].size(); // number of basis functions in this shell + + auto s2_max = bs1_equiv_bs2 ? s1 : nsh2 - 1; + for (auto s2 = 0; s2 <= s2_max; ++s2, ++s12) { + if (s12 % nthreads != thread_id) continue; + + auto n2 = bs2[s2].size(); + auto n12 = n1 * n2; + + engines[thread_id].compute2(bs1[s1], bs2[s2], + bs1[s1], bs2[s2]); + assert(buf[0] != nullptr && + "to compute Schwarz ints turn off primitive screening"); + + // to apply Schwarz inequality to individual integrals must use the "diagonal" elements + // to apply it to sets of functions (e.g. shells) use the whole shell-set of ints here + Eigen::Map buf_mat(buf[0], n12, n12); + auto norm2 = use_2norm ? buf_mat.norm() + : buf_mat.lpNorm(); + K(s1, s2) = std::sqrt(norm2); + if (bs1_equiv_bs2) K(s2, s1) = K(s1, s2); + } + } + }; // thread lambda + + libint2::parallel_do(compute); + + timer.stop(0); + std::cout << "done (" << timer.read(0) << " s)" << std::endl; + + return K; +} + +Matrix compute_do_ints(const BasisSet& bs1, const BasisSet& bs2, + bool use_2norm) { + return compute_schwarz_ints(bs1, bs2, use_2norm); +} + +std::tuple +compute_shellpairs(const BasisSet& bs1, + const BasisSet& _bs2, + const double threshold) { + const BasisSet& bs2 = (_bs2.empty() ? bs1 : _bs2); + const auto nsh1 = bs1.size(); + const auto nsh2 = bs2.size(); + const auto bs1_equiv_bs2 = (&bs1 == &bs2); + + using libint2::nthreads; + + // construct the overlap integral engines + using libint2::Engine; + std::vector engines; + engines.reserve(nthreads); + engines.emplace_back(Operator::overlap, + std::max(bs1.max_nprim(), bs2.max_nprim()), + std::max(bs1.max_l(), bs2.max_l()), 0); + engines[0].set_precision(0.); + for (size_t i = 1; i != nthreads; ++i) { + engines.push_back(engines[0]); + } + + std::cout << "computing non-negligible shell-pair list ... "; + + libint2::Timers<1> timer; + timer.set_now_overhead(25); + timer.start(0); + + shellpair_list_t splist; + + std::mutex mx; + + auto compute = [&](int thread_id) { + + auto& engine = engines[thread_id]; + const auto& buf = engine.results(); + + // loop over permutationally-unique set of shells + for (auto s1 = 0l, s12 = 0l; s1 != nsh1; ++s1) { + mx.lock(); + if (splist.find(s1) == splist.end()) + splist.insert(std::make_pair(s1, std::vector())); + mx.unlock(); + + auto n1 = bs1[s1].size(); // number of basis functions in this shell + + auto s2_max = bs1_equiv_bs2 ? s1 : nsh2 - 1; + for (auto s2 = 0; s2 <= s2_max; ++s2, ++s12) { + if (s12 % nthreads != thread_id) continue; + + auto on_same_center = (bs1[s1].O == bs2[s2].O); + bool significant = on_same_center; + if (not on_same_center) { + auto n2 = bs2[s2].size(); + engines[thread_id].compute(bs1[s1], bs2[s2]); + Eigen::Map buf_mat(buf[0], n1, n2); + auto norm = buf_mat.norm(); + significant = (norm >= threshold); + } + + if (significant) { + mx.lock(); + splist[s1].emplace_back(s2); + mx.unlock(); + } + } + } + }; // end of compute + + libint2::parallel_do(compute); + + // resort shell list in increasing order, i.e. splist[s][s1] < splist[s][s2] if s1 < s2 + // N.B. only parallelized over 1 shell index + auto sort = [&](int thread_id) { + for (auto s1 = 0l; s1 != nsh1; ++s1) { + if (s1 % nthreads == thread_id) { + auto& list = splist[s1]; + std::sort(list.begin(), list.end()); + } + } + }; // end of sort + + libint2::parallel_do(sort); + + // compute shellpair data assuming that we are computing to default_epsilon + // N.B. only parallelized over 1 shell index + const auto ln_max_engine_precision = std::log(max_engine_precision); + // assume shellpair data are used for Coulomb ints + for(auto&& eng: engines) { + eng.set(Operator::coulomb); + } + shellpair_data_t spdata(splist.size()); + auto make_spdata = [&](int thread_id) { + auto schwarz_factor_evaluator = [&](const Shell& s1, size_t p1, const Shell& s2, size_t p2) -> double { + auto& engine = engines[thread_id]; + auto& buf = engine.results(); + auto ps1 = s1.extract_primitive(p1, false); + auto ps2 = s2.extract_primitive(p2, false); + const auto n12 = ps1.size() * ps2.size(); + engine.compute(ps1, ps2, ps1, ps2); + if (buf[0]) { + Eigen::Map buf_mat(buf[0], n12, n12); + auto norm2 = screening_method == ScreeningMethod::SchwarzInf ? buf_mat.lpNorm() : buf_mat.norm(); + return std::sqrt(norm2); + } + else + return 0.; + }; + for (auto s1 = 0l; s1 != nsh1; ++s1) { + if (s1 % nthreads == thread_id) { + for (const auto &s2 : splist[s1]) { + if (screening_method == ScreeningMethod::Original || + screening_method == ScreeningMethod::Conservative) + spdata[s1].emplace_back(std::make_shared( + bs1[s1], bs2[s2], ln_max_engine_precision, screening_method)); + else { // Schwarz screening of primitives + spdata[s1].emplace_back(std::make_shared( + bs1[s1], bs2[s2], ln_max_engine_precision, screening_method, schwarz_factor_evaluator)); + } + } + } + } + }; // end of make_spdata + + libint2::parallel_do(make_spdata); + + timer.stop(0); + std::cout << "done (" << timer.read(0) << " s)" << std::endl; + + return std::make_tuple(splist,spdata); +} + +// returns {X,X^{-1},rank,A_condition_number,result_A_condition_number}, where +// X is the generalized square-root-inverse such that X.transpose() * A * X = I +// +// if symmetric is true, produce "symmetric" sqrtinv: X = U . A_evals_sqrtinv . +// U.transpose()), +// else produce "canonical" sqrtinv: X = U . A_evals_sqrtinv +// where U are eigenvectors of A +// rows and cols of symmetric X are equivalent; for canonical X the rows are +// original basis (AO), +// cols are transformed basis ("orthogonal" AO) +// +// A is conditioned to max_condition_number +std::tuple gensqrtinv( + const Matrix& S, bool symmetric = false, + double max_condition_number = 1e8) { + Eigen::SelfAdjointEigenSolver eig_solver(S); + auto U = eig_solver.eigenvectors(); + auto s = eig_solver.eigenvalues(); + auto s_max = s.maxCoeff(); + auto condition_number = std::min( + s_max / std::max(s.minCoeff(), std::numeric_limits::min()), + 1.0 / std::numeric_limits::epsilon()); + auto threshold = s_max / max_condition_number; + long n = s.rows(); + long n_cond = 0; + for (long i = n - 1; i >= 0; --i) { + if (s(i) >= threshold) { + ++n_cond; + } else + i = 0; // skip rest since eigenvalues are in ascending order + } + + auto sigma = s.bottomRows(n_cond); + auto result_condition_number = sigma.maxCoeff() / sigma.minCoeff(); + auto sigma_sqrt = sigma.array().sqrt().matrix().asDiagonal(); + auto sigma_invsqrt = sigma.array().sqrt().inverse().matrix().asDiagonal(); + + // make canonical X/Xinv + auto U_cond = U.block(0, n - n_cond, n, n_cond); + Matrix X = U_cond * sigma_invsqrt; + Matrix Xinv = U_cond * sigma_sqrt; + // convert to symmetric, if needed + if (symmetric) { + X = X * U_cond.transpose(); + Xinv = Xinv * U_cond.transpose(); + } + return std::make_tuple(X, Xinv, size_t(n_cond), condition_number, + result_condition_number); +} + +std::tuple conditioning_orthogonalizer( + const Matrix& S, double S_condition_number_threshold) { + size_t obs_rank; + double S_condition_number; + double XtX_condition_number; + Matrix X, Xinv; + + assert(S.rows() == S.cols()); + + std::tie(X, Xinv, obs_rank, S_condition_number, XtX_condition_number) = + gensqrtinv(S, false, S_condition_number_threshold); + auto obs_nbf_omitted = (long)S.rows() - (long)obs_rank; + std::cout << "overlap condition number = " << S_condition_number; + if (obs_nbf_omitted > 0) + std::cout << " (dropped " << obs_nbf_omitted << " " + << (obs_nbf_omitted > 1 ? "fns" : "fn") << " to reduce to " + << XtX_condition_number << ")"; + std::cout << std::endl; + + if (obs_nbf_omitted > 0) { + Matrix should_be_I = X.transpose() * S * X; + Matrix I = Matrix::Identity(should_be_I.rows(), should_be_I.cols()); + std::cout << "||X^t * S * X - I||_2 = " << (should_be_I - I).norm() + << " (should be 0)" << std::endl; + } + + return std::make_tuple(X, Xinv, XtX_condition_number); +} + +Matrix compute_2body_2index_ints(const BasisSet& bs) { + using libint2::nthreads; + const auto n = bs.nbf(); + const auto nshells = bs.size(); + Matrix result = Matrix::Zero(n, n); + + // build engines for each thread + using libint2::Engine; + std::vector engines(nthreads); + engines[0] = + Engine(libint2::Operator::coulomb, bs.max_nprim(), bs.max_l(), 0); + engines[0].set(BraKet::xs_xs); + engines[0].set(ScreeningMethod::Conservative); + for (size_t i = 1; i != nthreads; ++i) { + engines[i] = engines[0]; + } + + auto shell2bf = bs.shell2bf(); + auto unitshell = Shell::unit(); + + auto compute = [&](int thread_id) { + + auto& engine = engines[thread_id]; + const auto& buf = engine.results(); + + // loop over unique shell pairs, {s1,s2} such that s1 >= s2 + // this is due to the permutational symmetry of the real integrals over + // Hermitian operators: (1|2) = (2|1) + for (auto s1 = 0l, s12 = 0l; s1 != nshells; ++s1) { + auto bf1 = shell2bf[s1]; // first basis function in this shell + auto n1 = bs[s1].size(); + + for (auto s2 = 0; s2 <= s1; ++s2, ++s12) { + if (s12 % nthreads != thread_id) continue; + + auto bf2 = shell2bf[s2]; + auto n2 = bs[s2].size(); + + // compute shell pair; return is the pointer to the buffer + engine.compute(bs[s1], bs[s2]); + if (buf[0] == nullptr) + continue; // if all integrals screened out, skip to next shell set + + // "map" buffer to a const Eigen Matrix, and copy it to the + // corresponding blocks of the result + Eigen::Map buf_mat(buf[0], n1, n2); + result.block(bf1, bf2, n1, n2) = buf_mat; + if (s1 != s2) // if s1 >= s2, copy {s1,s2} to the corresponding {s2,s1} + // block, note the transpose! + result.block(bf2, bf1, n2, n1) = buf_mat.transpose(); + } + } + }; // compute lambda + + libint2::parallel_do(compute); + + return result; +} + +Matrix compute_2body_fock(const BasisSet& obs, const Matrix& D, + double precision, const Matrix& Schwarz) { + const auto n = obs.nbf(); + const auto nshells = obs.size(); + using libint2::nthreads; + std::vector G(nthreads, Matrix::Zero(n, n)); + + const auto do_schwarz_screen = Schwarz.cols() != 0 && Schwarz.rows() != 0; + Matrix D_shblk_norm = + compute_shellblock_norm(obs, D); // matrix of infty-norms of shell blocks + + auto fock_precision = precision; + // standard approach is to omit *contributions* to the Fock matrix smaller than fock_precision ... this relies on massive amount of error cancellation + auto max_nprim = obs.max_nprim(); + auto needed_engine_precision = (fock_precision / D_shblk_norm.maxCoeff()); + assert(needed_engine_precision > max_engine_precision && + "using precomputed shell pair data limits the max engine precision" + " ... make max_engine_precision smaller and recompile"); + + // construct the 2-electron repulsion integrals engine pool + using libint2::Engine; + std::vector engines(nthreads); + engines[0] = Engine(Operator::coulomb, obs.max_nprim(), obs.max_l(), 0); + engines[0].set(screening_method); + engines[0].set_precision(needed_engine_precision); // N.B. precision will be adjusted for each shellset + std::cout << "compute_2body_fock:precision = " << precision << std::endl; + std::cout << "will set Engine::precision as low as = " << engines[0].precision() << std::endl; + for (size_t i = 1; i != nthreads; ++i) { + engines[i] = engines[0]; + } + std::atomic num_ints_computed{0}; + +#if defined(REPORT_INTEGRAL_TIMINGS) + std::vector> timers(nthreads); +#endif + + auto shell2bf = obs.shell2bf(); + + auto lambda = [&](int thread_id) { + + auto& engine = engines[thread_id]; + auto& g = G[thread_id]; + const auto& buf = engine.results(); + +#if defined(REPORT_INTEGRAL_TIMINGS) + auto& timer = timers[thread_id]; + timer.clear(); + timer.set_now_overhead(25); +#endif + + // loop over permutationally-unique set of shells + for (auto s1 = 0l, s1234 = 0l; s1 != nshells; ++s1) { + auto bf1_first = shell2bf[s1]; // first basis function in this shell + auto n1 = obs[s1].size(); // number of basis functions in this shell + + auto sp12_iter = obs_shellpair_data.at(s1).begin(); + + for (const auto& s2 : obs_shellpair_list[s1]) { + auto bf2_first = shell2bf[s2]; + auto n2 = obs[s2].size(); + + const auto* sp12 = sp12_iter->get(); + ++sp12_iter; + + const auto Dnorm12 = do_schwarz_screen ? D_shblk_norm(s1, s2) : 0.; + + for (auto s3 = 0; s3 <= s1; ++s3) { + auto bf3_first = shell2bf[s3]; + auto n3 = obs[s3].size(); + + const auto Dnorm123 = + do_schwarz_screen + ? std::max(D_shblk_norm(s1, s3), + std::max(D_shblk_norm(s2, s3), Dnorm12)) + : 0.; + + auto sp34_iter = obs_shellpair_data.at(s3).begin(); + + const auto s4_max = (s1 == s3) ? s2 : s3; + for (const auto& s4 : obs_shellpair_list[s3]) { + if (s4 > s4_max) + break; // for each s3, s4 are stored in monotonically increasing + // order + + // must update the iter even if going to skip s4 + const auto* sp34 = sp34_iter->get(); + ++sp34_iter; + + if ((s1234++) % nthreads != thread_id) continue; + + const auto Dnorm1234 = + do_schwarz_screen + ? std::max( + D_shblk_norm(s1, s4), + std::max(D_shblk_norm(s2, s4), + std::max(D_shblk_norm(s3, s4), Dnorm123))) + : 0.; + + if (do_schwarz_screen && + Dnorm1234 * Schwarz(s1, s2) * Schwarz(s3, s4) < + fock_precision) + continue; + + auto bf4_first = shell2bf[s4]; + auto n4 = obs[s4].size(); + + // compute the permutational degeneracy (i.e. # of equivalents) of + // the given shell set + auto s12_deg = (s1 == s2) ? 1 : 2; + auto s34_deg = (s3 == s4) ? 1 : 2; + auto s12_34_deg = (s1 == s3) ? (s2 == s4 ? 1 : 2) : 2; + auto s1234_deg = s12_deg * s34_deg * s12_34_deg; + +#if defined(REPORT_INTEGRAL_TIMINGS) + timer.start(0); +#endif + + // vary precision for each shellset to guarantee precision of the contribution to the Fock matrix + engine.set_precision(Dnorm1234 != 0. ? fock_precision / Dnorm1234 : needed_engine_precision); + engine.compute2( + obs[s1], obs[s2], obs[s3], obs[s4], sp12, sp34); + const auto* buf_1234 = buf[0]; + if (buf_1234 == nullptr) + continue; // if all integrals screened out, skip to next quartet + + num_ints_computed += n1 * n2 * n3 * n4; + +#if defined(REPORT_INTEGRAL_TIMINGS) + timer.stop(0); +#endif + + // 1) each shell set of integrals contributes up to 6 shell sets of + // the Fock matrix: + // F(a,b) += (ab|cd) * D(c,d) + // F(c,d) += (ab|cd) * D(a,b) + // F(b,d) -= 1/4 * (ab|cd) * D(a,c) + // F(b,c) -= 1/4 * (ab|cd) * D(a,d) + // F(a,c) -= 1/4 * (ab|cd) * D(b,d) + // F(a,d) -= 1/4 * (ab|cd) * D(b,c) + // 2) each permutationally-unique integral (shell set) must be + // scaled by its degeneracy, + // i.e. the number of the integrals/sets equivalent to it + // 3) the end result must be symmetrized + for (auto f1 = 0, f1234 = 0; f1 != n1; ++f1) { + const auto bf1 = f1 + bf1_first; + for (auto f2 = 0; f2 != n2; ++f2) { + const auto bf2 = f2 + bf2_first; + for (auto f3 = 0; f3 != n3; ++f3) { + const auto bf3 = f3 + bf3_first; + for (auto f4 = 0; f4 != n4; ++f4, ++f1234) { + const auto bf4 = f4 + bf4_first; + + const auto value = buf_1234[f1234]; + + const auto value_scal_by_deg = value * s1234_deg; + + g(bf1, bf2) += D(bf3, bf4) * value_scal_by_deg; + g(bf3, bf4) += D(bf1, bf2) * value_scal_by_deg; + g(bf1, bf3) -= 0.25 * D(bf2, bf4) * value_scal_by_deg; + g(bf2, bf4) -= 0.25 * D(bf1, bf3) * value_scal_by_deg; + g(bf1, bf4) -= 0.25 * D(bf2, bf3) * value_scal_by_deg; + g(bf2, bf3) -= 0.25 * D(bf1, bf4) * value_scal_by_deg; + } + } + } + } + } + } + } + } + + }; // end of lambda + + libint2::parallel_do(lambda); + + // accumulate contributions from all threads + for (size_t i = 1; i != nthreads; ++i) { + G[0] += G[i]; + } + +#if defined(REPORT_INTEGRAL_TIMINGS) + double time_for_ints = 0.0; + for (auto& t : timers) { + time_for_ints += t.read(0); + } + std::cout << "time for integrals = " << time_for_ints << std::endl; + for (int t = 0; t != nthreads; ++t) engines[t].print_timers(); +#endif + + Matrix GG = 0.5 * (G[0] + G[0].transpose()); + + std::cout << "# of integrals = " << num_ints_computed << std::endl; + + // symmetrize the result and return + return GG; +} + +#if LIBINT2_DERIV_ERI_ORDER +template +std::vector compute_2body_fock_deriv(const BasisSet& obs, + const std::vector& atoms, + const Matrix& D, double precision, + const Matrix& Schwarz) { + const auto n = obs.nbf(); + const auto nshells = obs.size(); + const auto nderiv_shellset = + libint2::num_geometrical_derivatives(4, deriv_order); // # of derivs for each shell quartet + const auto nderiv = libint2::num_geometrical_derivatives( + atoms.size(), deriv_order); // total # of derivs + const auto ncoords_times_two = (atoms.size() * 3) * 2; + using libint2::nthreads; + std::vector G(nthreads * nderiv, Matrix::Zero(n, n)); + + const auto do_schwarz_screen = Schwarz.cols() != 0 && Schwarz.rows() != 0; + Matrix D_shblk_norm = + compute_shellblock_norm(obs, D); // matrix of infty-norms of shell blocks + + auto fock_precision = precision; + // standard approach is to omit *contributions* to the Fock matrix smaller than fock_precision ... this relies on massive amount of error cancellation + auto max_nprim = obs.max_nprim(); + auto needed_engine_precision = (fock_precision / D_shblk_norm.maxCoeff()); + assert(needed_engine_precision > max_engine_precision && + "using precomputed shell pair data limits the max engine precision" + " ... make max_engine_precision smaller and recompile"); + + // construct the 2-electron repulsion integrals engine pool + using libint2::Engine; + std::vector engines(nthreads); + engines[0] = + Engine(Operator::coulomb, obs.max_nprim(), obs.max_l(), deriv_order); + engines[0].set(screening_method); + engines[0].set_precision(needed_engine_precision); // N.B. precision will be adjusted for each shellset + std::cout << "compute_2body_fock:precision = " << precision << std::endl; + std::cout << "will set Engine::precision as low as = " << engines[0].precision() << std::endl; + for (size_t i = 1; i != nthreads; ++i) { + engines[i] = engines[0]; + } + std::atomic num_ints_computed{0}; + +#if defined(REPORT_INTEGRAL_TIMINGS) + std::vector> timers(nthreads); +#endif + + auto shell2bf = obs.shell2bf(); + auto shell2atom = obs.shell2atom(atoms); + + auto lambda = [&](int thread_id) { + + auto& engine = engines[thread_id]; + const auto& buf = engine.results(); + +#if defined(REPORT_INTEGRAL_TIMINGS) + auto& timer = timers[thread_id]; + timer.clear(); + timer.set_now_overhead(25); +#endif + + size_t shell_atoms[4]; + + // loop over permutationally-unique set of shells + for (auto s1 = 0l, s1234 = 0l; s1 != nshells; ++s1) { + auto bf1_first = shell2bf[s1]; // first basis function in this shell + auto n1 = obs[s1].size(); // number of basis functions in this shell + shell_atoms[0] = shell2atom[s1]; + + auto sp12_iter = obs_shellpair_data.at(s1).begin(); + + for (const auto& s2 : obs_shellpair_list[s1]) { + auto bf2_first = shell2bf[s2]; + auto n2 = obs[s2].size(); + shell_atoms[1] = shell2atom[s2]; + + const auto* sp12 = sp12_iter->get(); + ++sp12_iter; + + const auto Dnorm12 = do_schwarz_screen ? D_shblk_norm(s1, s2) : 0.; + + for (auto s3 = 0; s3 <= s1; ++s3) { + auto bf3_first = shell2bf[s3]; + auto n3 = obs[s3].size(); + shell_atoms[2] = shell2atom[s3]; + + const auto Dnorm123 = + do_schwarz_screen + ? std::max(D_shblk_norm(s1, s3), + std::max(D_shblk_norm(s2, s3), Dnorm12)) + : 0.; + + auto sp34_iter = obs_shellpair_data.at(s3).begin(); + + const auto s4_max = (s1 == s3) ? s2 : s3; + for (const auto& s4 : obs_shellpair_list[s3]) { + if (s4 > s4_max) + break; // for each s3, s4 are stored in monotonically increasing + // order + + // must update the iter even if going to skip s4 + const auto* sp34 = sp34_iter->get(); + ++sp34_iter; + + if ((s1234++) % nthreads != thread_id) continue; + + const auto Dnorm1234 = + do_schwarz_screen + ? std::max( + D_shblk_norm(s1, s4), + std::max(D_shblk_norm(s2, s4), + std::max(D_shblk_norm(s3, s4), Dnorm123))) + : 0.; + + if (do_schwarz_screen && + Dnorm1234 * Schwarz(s1, s2) * Schwarz(s3, s4) < + fock_precision) + continue; + + auto bf4_first = shell2bf[s4]; + auto n4 = obs[s4].size(); + shell_atoms[3] = shell2atom[s4]; + + const auto n1234 = n1 * n2 * n3 * n4; + + // compute the permutational degeneracy (i.e. # of equivalents) of + // the given shell set + auto s12_deg = (s1 == s2) ? 1.0 : 2.0; + auto s34_deg = (s3 == s4) ? 1.0 : 2.0; + auto s12_34_deg = (s1 == s3) ? (s2 == s4 ? 1.0 : 2.0) : 2.0; + auto s1234_deg = s12_deg * s34_deg * s12_34_deg; + + // computes contribution from shell set \c idx to the operator matrix with + // index \c op + auto add_shellset_to_dest = [&]( + std::size_t op, std::size_t idx, int coord1, int coord2, double scale = 1.0) { + auto& g = G[op]; + auto shset = buf[idx]; + const auto weight = scale * s1234_deg; + + for (auto f1 = 0, f1234 = 0; f1 != n1; ++f1) { + const auto bf1 = f1 + bf1_first; + for (auto f2 = 0; f2 != n2; ++f2) { + const auto bf2 = f2 + bf2_first; + for (auto f3 = 0; f3 != n3; ++f3) { + const auto bf3 = f3 + bf3_first; + for (auto f4 = 0; f4 != n4; ++f4, ++f1234) { + const auto bf4 = f4 + bf4_first; + + const auto value = shset[f1234]; + const auto wvalue = value * weight; + + g(bf1, bf2) += D(bf3, bf4) * wvalue; + g(bf3, bf4) += D(bf1, bf2) * wvalue; + g(bf1, bf3) -= 0.25 * D(bf2, bf4) * wvalue; + g(bf2, bf4) -= 0.25 * D(bf1, bf3) * wvalue; + g(bf1, bf4) -= 0.25 * D(bf2, bf3) * wvalue; + g(bf2, bf3) -= 0.25 * D(bf1, bf4) * wvalue; + } + } + } + } + }; + +#if defined(REPORT_INTEGRAL_TIMINGS) + timer.start(0); +#endif + + // vary precision for each shellset to guarantee precision of the contribution to the Fock matrix + engine.set_precision(Dnorm1234 != 0. ? fock_precision / Dnorm1234 : needed_engine_precision); + engine.compute2( + obs[s1], obs[s2], obs[s3], obs[s4], sp12, sp34); + if (buf[0] == nullptr) + continue; // if all integrals screened out, skip to next quartet + num_ints_computed += nderiv_shellset * n1234; + +#if defined(REPORT_INTEGRAL_TIMINGS) + timer.stop(0); +#endif + + switch (deriv_order) { + case 0: { + int coord1 = 0, coord2 = 0; + add_shellset_to_dest(thread_id, 0, coord1, coord2); + } break; + + case 1: { + for (auto d = 0; d != 12; ++d) { + const int a = d / 3; + const int xyz = d % 3; + + auto coord = shell_atoms[a] * 3 + xyz; + auto& g = G[thread_id * nderiv + coord]; + + int coord1 = 0, coord2 = 0; + + add_shellset_to_dest(thread_id * nderiv + coord, d, coord1, coord2); + + } // d \in [0,12) + } break; + + case 2: { + // computes upper triangle index + // n2 = matrix size times 2 + // i,j = (unordered) indices + auto upper_triangle_index = [](size_t n2, size_t i, size_t j) { + return std::min(i, j) * (n2 - (std::min(i, j)) - 1) / 2 + std::max(i, j); + }; + // look over shellsets in the order in which they appear + std::size_t shellset_idx = 0; + for (auto c1 = 0; c1 != 4; ++c1) { + auto a1 = shell_atoms[c1]; + auto coord1 = 3 * a1; + for (auto xyz1 = 0; xyz1 != 3; ++xyz1, ++coord1) { + for (auto c2 = c1; c2 != 4; ++c2) { + auto a2 = shell_atoms[c2]; + auto xyz2_start = (c1 == c2) ? xyz1 : 0; + auto coord2 = 3 * a2 + xyz2_start; + for (auto xyz2 = xyz2_start; xyz2 != 3; + ++xyz2, ++coord2) { + double scale = + (coord1 == coord2 && c1 != c2) ? 2.0 : 1.0; + + const auto coord12 = upper_triangle_index( + ncoords_times_two, coord1, coord2); + auto op = thread_id * nderiv + coord12; + add_shellset_to_dest(op, shellset_idx, coord1, coord2, scale); + ++shellset_idx; + } + } + } + } + } break; + + default: + assert(deriv_order <= 2 && + "support for 3rd and higher derivatives of the Fock " + "matrix not yet implemented"); + } + } + } + } + } + + }; // end of lambda + + libint2::parallel_do(lambda); + + // accumulate contributions from all threads + for (size_t t = 1; t != nthreads; ++t) { + for (auto d = 0; d != nderiv; ++d) { + G[d] += G[t * nderiv + d]; + } + } + +#if defined(REPORT_INTEGRAL_TIMINGS) + double time_for_ints = 0.0; + for (auto& t : timers) { + time_for_ints += t.read(0); + } + std::cout << "time for integrals = " << time_for_ints << std::endl; + for (int t = 0; t != nthreads; ++t) engines[t].print_timers(); +#endif + + std::vector GG(nderiv); + for (auto d = 0; d != nderiv; ++d) { + GG[d] = 0.5 * (G[d] + G[d].transpose()); + } + + std::cout << "# of integrals = " << num_ints_computed << std::endl; + + // symmetrize the result and return + return GG; +} + +#endif + +Matrix compute_2body_fock_general(const BasisSet& obs, const Matrix& D, + const BasisSet& D_bs, bool D_is_shelldiagonal, + double precision) { + const auto n = obs.nbf(); + const auto nshells = obs.size(); + const auto n_D = D_bs.nbf(); + assert(D.cols() == D.rows() && D.cols() == n_D); + + using libint2::nthreads; + std::vector G(nthreads, Matrix::Zero(n, n)); + + // construct the 2-electron repulsion integrals engine + using libint2::Engine; + std::vector engines(nthreads); + engines[0] = Engine(libint2::Operator::coulomb, + std::max(obs.max_nprim(), D_bs.max_nprim()), + std::max(obs.max_l(), D_bs.max_l()), 0); + engines[0].set_precision(precision); + for (size_t i = 1; i != nthreads; ++i) { + engines[i] = engines[0]; + } + auto shell2bf = obs.shell2bf(); + auto shell2bf_D = D_bs.shell2bf(); + + auto lambda = [&](int thread_id) { + + auto& engine = engines[thread_id]; + auto& g = G[thread_id]; + const auto& buf = engine.results(); + + // loop over permutationally-unique set of shells + for (auto s1 = 0l, s1234 = 0l; s1 != nshells; ++s1) { + auto bf1_first = shell2bf[s1]; // first basis function in this shell + auto n1 = obs[s1].size(); // number of basis functions in this shell + + for (auto s2 = 0; s2 <= s1; ++s2) { + auto bf2_first = shell2bf[s2]; + auto n2 = obs[s2].size(); + + for (auto s3 = 0; s3 < D_bs.size(); ++s3) { + auto bf3_first = shell2bf_D[s3]; + auto n3 = D_bs[s3].size(); + + auto s4_begin = D_is_shelldiagonal ? s3 : 0; + auto s4_fence = D_is_shelldiagonal ? s3 + 1 : D_bs.size(); + + for (auto s4 = s4_begin; s4 != s4_fence; ++s4, ++s1234) { + if (s1234 % nthreads != thread_id) continue; + + auto bf4_first = shell2bf_D[s4]; + auto n4 = D_bs[s4].size(); + + // compute the permutational degeneracy (i.e. # of equivalents) of + // the given shell set + auto s12_deg = (s1 == s2) ? 1.0 : 2.0; + + if (s3 >= s4) { + auto s34_deg = (s3 == s4) ? 1.0 : 2.0; + auto s1234_deg = s12_deg * s34_deg; + // auto s1234_deg = s12_deg; + engine.compute2( + obs[s1], obs[s2], D_bs[s3], D_bs[s4]); + const auto* buf_1234 = buf[0]; + if (buf_1234 != nullptr) { + for (auto f1 = 0, f1234 = 0; f1 != n1; ++f1) { + const auto bf1 = f1 + bf1_first; + for (auto f2 = 0; f2 != n2; ++f2) { + const auto bf2 = f2 + bf2_first; + for (auto f3 = 0; f3 != n3; ++f3) { + const auto bf3 = f3 + bf3_first; + for (auto f4 = 0; f4 != n4; ++f4, ++f1234) { + const auto bf4 = f4 + bf4_first; + + const auto value = buf_1234[f1234]; + const auto value_scal_by_deg = value * s1234_deg; + g(bf1, bf2) += 2.0 * D(bf3, bf4) * value_scal_by_deg; + } + } + } + } + } + } + + engine.compute2( + obs[s1], D_bs[s3], obs[s2], D_bs[s4]); + const auto* buf_1324 = buf[0]; + if (buf_1324 == nullptr) + continue; // if all integrals screened out, skip to next quartet + + for (auto f1 = 0, f1324 = 0; f1 != n1; ++f1) { + const auto bf1 = f1 + bf1_first; + for (auto f3 = 0; f3 != n3; ++f3) { + const auto bf3 = f3 + bf3_first; + for (auto f2 = 0; f2 != n2; ++f2) { + const auto bf2 = f2 + bf2_first; + for (auto f4 = 0; f4 != n4; ++f4, ++f1324) { + const auto bf4 = f4 + bf4_first; + + const auto value = buf_1324[f1324]; + const auto value_scal_by_deg = value * s12_deg; + g(bf1, bf2) -= D(bf3, bf4) * value_scal_by_deg; + } + } + } + } + } + } + } + } + + }; // thread lambda + + libint2::parallel_do(lambda); + + // accumulate contributions from all threads + for (size_t i = 1; i != nthreads; ++i) { + G[0] += G[i]; + } + + // symmetrize the result and return + return 0.5 * (G[0] + G[0].transpose()); +} + +#ifdef HAVE_DENSITY_FITTING + +Matrix DFFockEngine::compute_2body_fock_dfC(const Matrix& Cocc) { + + using libint2::nthreads; + + const auto n = obs.nbf(); + const auto ndf = dfbs.nbf(); + + libint2::Timers<1> wall_timer; + wall_timer.set_now_overhead(25); + std::vector> timers(nthreads); + for(auto& timer: timers) timer.set_now_overhead(25); + + typedef btas::RangeNd> Range1d; + typedef btas::RangeNd> Range2d; + typedef btas::Tensor Tensor1d; + typedef btas::Tensor Tensor2d; + + // using first time? compute 3-center ints and transform to inv sqrt + // representation + if (xyK.size() == 0) { + + wall_timer.start(0); + + const auto nshells = obs.size(); + const auto nshells_df = dfbs.size(); + const auto& unitshell = libint2::Shell::unit(); + + // construct the 2-electron 3-center repulsion integrals engine + // since the code assumes (xx|xs) braket, and Engine/libint only produces + // (xs|xx), use 4-center engine + std::vector engines(nthreads); + engines[0] = libint2::Engine(libint2::Operator::coulomb, + std::max(obs.max_nprim(), dfbs.max_nprim()), + std::max(obs.max_l(), dfbs.max_l()), 0); + engines[0].set(BraKet::xs_xx); + for (size_t i = 1; i != nthreads; ++i) { + engines[i] = engines[0]; + } + + auto shell2bf = obs.shell2bf(); + auto shell2bf_df = dfbs.shell2bf(); + + Tensor3d Zxy{ndf, n, n}; + + auto lambda = [&](int thread_id) { + + auto& engine = engines[thread_id]; + auto& timer = timers[thread_id]; + const auto& results = engine.results(); + + // loop over permutationally-unique set of shells + for (auto s1 = 0l, s123 = 0l; s1 != nshells_df; ++s1) { + auto bf1_first = shell2bf_df[s1]; // first basis function in this shell + auto n1 = dfbs[s1].size(); // number of basis functions in this shell + + for (auto s2 = 0; s2 != nshells; ++s2) { + auto bf2_first = shell2bf[s2]; + auto n2 = obs[s2].size(); + const auto n12 = n1 * n2; + + for (auto s3 = 0; s3 != nshells; ++s3, ++s123) { + if (s123 % nthreads != thread_id) continue; + + auto bf3_first = shell2bf[s3]; + auto n3 = obs[s3].size(); + const auto n123 = n12 * n3; + + timer.start(0); + + engine.compute2( + dfbs[s1], unitshell, obs[s2], obs[s3]); + const auto* buf = results[0]; + if (buf == nullptr) + continue; + + timer.stop(0); + timer.start(1); + + auto lower_bound = {bf1_first, bf2_first, bf3_first}; + auto upper_bound = {bf1_first + n1, bf2_first + n2, bf3_first + n3}; + auto view = btas::make_view( + Zxy.range().slice(lower_bound, upper_bound), Zxy.storage()); + std::copy(buf, buf + n123, view.begin()); + + timer.stop(1); + } // s3 + } // s2 + } // s1 + + }; // lambda + + libint2::parallel_do(lambda); + + wall_timer.stop(0); + + double ints_time = 0; + for(const auto& timer: timers) ints_time += timer.read(0); + std::cout << "time for Zxy integrals = " << ints_time << " (total from all threads)" << std::endl; + double copy_time = 0; + for(const auto& timer: timers) copy_time += timer.read(1); + std::cout << "time for copying into BTAS = " << copy_time << " (total from all threads)"<< std::endl; + std::cout << "wall time for Zxy integrals + copy = " << wall_timer.read(0) << std::endl; + + timers[0].start(2); + + Matrix V = compute_2body_2index_ints(dfbs); + Eigen::LLT V_LLt(V); + Matrix I = Matrix::Identity(ndf, ndf); + auto L = V_LLt.matrixL(); + Matrix V_L = L; + Matrix Linv_t = L.solve(I).transpose(); + // check + // std::cout << "||V - L L^t|| = " << (V - V_L * V_L.transpose()).norm() << + // std::endl; + // std::cout << "||I - L L^-1|| = " << (I - V_L * + // Linv_t.transpose()).norm() << std::endl; + // std::cout << "||V^-1 - L^-1^t L^-1|| = " << (V.inverse() - Linv_t * + // Linv_t.transpose()).norm() << std::endl; + + Tensor2d K{ndf, ndf}; + std::copy(Linv_t.data(), Linv_t.data() + ndf * ndf, K.begin()); + + xyK = Tensor3d{n, n, ndf}; + btas::contract(1.0, Zxy, {1, 2, 3}, K, {1, 4}, 0.0, xyK, {2, 3, 4}); + Zxy = Tensor3d{0, 0, 0}; // release memory + + timers[0].stop(2); + std::cout << "time for integrals metric tform = " << timers[0].read(2) + << std::endl; + } // if (xyK.size() == 0) + + // compute exchange + timers[0].start(3); + + const auto nocc = Cocc.cols(); + Tensor2d Co{n, nocc}; + std::copy(Cocc.data(), Cocc.data() + n * nocc, Co.begin()); + Tensor3d xiK{n, nocc, ndf}; + btas::contract(1.0, xyK, {1, 2, 3}, Co, {2, 4}, 0.0, xiK, {1, 4, 3}); + + Tensor2d G{n, n}; + btas::contract(1.0, xiK, {1, 2, 3}, xiK, {4, 2, 3}, 0.0, G, {1, 4}); + + timers[0].stop(3); + std::cout << "time for exchange = " << timers[0].read(3) << std::endl; + + // compute Coulomb + timers[0].start(4); + + Tensor1d Jtmp{ndf}; + btas::contract(1.0, xiK, {1, 2, 3}, Co, {1, 2}, 0.0, Jtmp, {3}); + xiK = Tensor3d{0, 0, 0}; + btas::contract(2.0, xyK, {1, 2, 3}, Jtmp, {3}, -1.0, G, {1, 2}); + + timers[0].stop(4); + std::cout << "time for coulomb = " << timers[0].read(4) << std::endl; + + // copy result to an Eigen::Matrix + Matrix result(n, n); + std::copy(G.cbegin(), G.cend(), result.data()); + return result; +} +#endif // HAVE_DENSITY_FITTING + +// should be a unit test somewhere +void api_basic_compile_test(const BasisSet& obs, + const std::vector& atoms) { + using namespace libint2; + Engine onebody_engine( + Operator::overlap, // will compute overlap ints + obs.max_nprim(), // max # of primitives in shells this engine will + // accept + obs.max_l() // max angular momentum of shells this engine will accept + ); + auto shell2bf = obs.shell2bf(); + const auto& results = onebody_engine.results(); + for (auto s1 = 0; s1 != obs.size(); ++s1) { + for (auto s2 = 0; s2 != obs.size(); ++s2) { + std::cout << "compute shell set {" << s1 << "," << s2 << "} ... "; + onebody_engine.compute(obs[s1], obs[s2]); + const auto* ints_shellset = results[0]; + std::cout << "done" << std::endl; + + auto bf1 = shell2bf[s1]; // first basis function in first shell + auto n1 = obs[s1].size(); // number of basis functions in first shell + auto bf2 = shell2bf[s2]; // first basis function in second shell + auto n2 = obs[s2].size(); // number of basis functions in second shell + + // this iterates over integrals in the order they are packed in array + // ints_shellset + for (auto f1 = 0; f1 != n1; ++f1) + for (auto f2 = 0; f2 != n2; ++f2) + std::cout << " " << bf1 + f1 << " " << bf2 + f2 << " " + << ints_shellset[f1 * n2 + f2] << std::endl; + } + } + + using libint2::Operator; + + std::vector> cgtg_params{ + {0.1, 0.2}, {0.3, 0.4}, {0.5, 0.6}}; + { + auto K = + compute_schwarz_ints(obs, obs, false, cgtg_params); + std::cout << "cGTG Schwarz ints\n" << K << std::endl; + } + { + auto K = compute_schwarz_ints(obs, obs, false, + cgtg_params); + std::cout << "cGTG/r12 Schwarz ints\n" << K << std::endl; + } + { + auto K = + compute_schwarz_ints(obs, obs, false, cgtg_params); + std::cout << "||Del.cGTG||^2 Schwarz ints\n" << K << std::endl; + } + double attenuation_omega = 1.0; + { + auto K = + compute_schwarz_ints(obs, obs, false, attenuation_omega); + std::cout << "erfc_coulomb Schwarz ints\n" << K << std::endl; + } + { + auto K = + compute_schwarz_ints(obs, obs, false, attenuation_omega); + std::cout << "erf_coulomb Schwarz ints\n" << K << std::endl; + } + { + auto V = compute_1body_ints( + obs, + libint2::make_point_charges(atoms))[0]; + std::cout << "nuclear ints\n" << V << std::endl; + auto V_erfc = compute_1body_ints( + obs, + std::make_tuple(attenuation_omega, libint2::make_point_charges(atoms)))[0]; + std::cout << "erfc_nuclear ints\n" << V_erfc << std::endl; + auto V_erf = compute_1body_ints( + obs, + std::make_tuple(attenuation_omega, libint2::make_point_charges(atoms)))[0]; + std::cout << "erf_nuclear ints\n" << V_erf << std::endl; + std::cout << "V - (V_erfc + V_erf)" << Matrix(V - V_erfc - V_erf) << std::endl; + } + + { // test 2-index ints + Engine eri4_engine(Operator::coulomb, obs.max_nprim(), obs.max_l()); + Engine eri2_engine = eri4_engine; + eri2_engine.set(BraKet::xs_xs); + auto shell2bf = obs.shell2bf(); + const auto& results4 = eri4_engine.results(); + const auto& results2 = eri2_engine.results(); + for (auto s1 = 0; s1 != obs.size(); ++s1) { + for (auto s2 = 0; s2 != obs.size(); ++s2) { + eri4_engine.compute(obs[s1], Shell::unit(), obs[s2], Shell::unit()); + eri2_engine.compute(obs[s1], obs[s2]); + + auto bf1 = shell2bf[s1]; // first basis function in first shell + auto n1 = obs[s1].size(); // number of basis functions in first shell + auto bf2 = shell2bf[s2]; // first basis function in second shell + auto n2 = obs[s2].size(); // number of basis functions in second shell + + const auto* buf4 = results4[0]; + const auto* buf2 = results2[0]; + + // this iterates over integrals in the order they are packed in array + // ints_shellset + for (auto f1 = 0, f12 = 0; f1 != n1; ++f1) + for (auto f2 = 0; f2 != n2; ++f2, ++f12) + assert(std::abs(buf4[f12] - buf2[f12]) < 1e-12 && + "2-center ints test failed"); + } + } + } + { // test 3-index ints + Engine eri4_engine(Operator::coulomb, obs.max_nprim(), obs.max_l()); + Engine eri3_engine = eri4_engine; + eri3_engine.set(BraKet::xs_xx); + auto shell2bf = obs.shell2bf(); + const auto& results4 = eri4_engine.results(); + const auto& results3 = eri3_engine.results(); + for (auto s1 = 0; s1 != obs.size(); ++s1) { + for (auto s2 = 0; s2 != obs.size(); ++s2) { + for (auto s3 = 0; s3 != obs.size(); ++s3) { + eri4_engine.compute(obs[s1], Shell::unit(), obs[s2], obs[s3]); + eri3_engine.compute(obs[s1], obs[s2], obs[s3]); + + auto bf1 = shell2bf[s1]; // first basis function in first shell + auto n1 = obs[s1].size(); // number of basis functions in first shell + auto bf2 = shell2bf[s2]; // first basis function in second shell + auto n2 = + obs[s2].size(); // number of basis functions in second shell + auto bf3 = shell2bf[s3]; // first basis function in third shell + auto n3 = obs[s3].size(); // number of basis functions in third shell + + const auto* buf4 = results4[0]; + const auto* buf3 = results3[0]; + + // this iterates over integrals in the order they are packed in array + // ints_shellset + for (auto f1 = 0, f123 = 0; f1 != n1; ++f1) + for (auto f2 = 0; f2 != n2; ++f2) + for (auto f3 = 0; f3 != n3; ++f3, ++f123) + assert(std::abs(buf4[f123] - buf3[f123]) < 1e-12 && + "3-center ints test failed"); + } + } + } + } + +#if LIBINT2_DERIV_ERI_ORDER + { // test deriv 2-index ints + Engine eri4_engine(Operator::coulomb, obs.max_nprim(), obs.max_l(), 1); + Engine eri2_engine = eri4_engine; + eri2_engine.set(BraKet::xs_xs); + auto shell2bf = obs.shell2bf(); + const auto& results4 = eri4_engine.results(); + const auto& results2 = eri2_engine.results(); + for (auto s1 = 0; s1 != obs.size(); ++s1) { + for (auto s2 = 0; s2 != obs.size(); ++s2) { + eri4_engine.compute(obs[s1], Shell::unit(), obs[s2], Shell::unit()); + eri2_engine.compute(obs[s1], obs[s2]); + + auto bf1 = shell2bf[s1]; // first basis function in first shell + auto n1 = obs[s1].size(); // number of basis functions in first shell + auto bf2 = shell2bf[s2]; // first basis function in second shell + auto n2 = obs[s2].size(); // number of basis functions in second shell + + // loop over derivative shell sets + for(auto d=0; d!=6; ++d) { + const auto* buf4 = results4[d<3 ? d : d+3]; + const auto* buf2 = results2[d]; + + // this iterates over integrals in the order they are packed in array + // ints_shellset + for (auto f1 = 0, f12 = 0; f1 != n1; ++f1) + for (auto f2 = 0; f2 != n2; ++f2, ++f12) + assert(std::abs(buf4[f12] - buf2[f12]) < 1e-12 && + "deriv 2-center ints test failed"); + } + + } + } + } +#endif + +#if LIBINT2_DERIV_ERI_ORDER > 1 + { // test 2nd deriv 2-index ints + Engine eri4_engine(Operator::coulomb, obs.max_nprim(), obs.max_l(), 2); + Engine eri2_engine = eri4_engine; + eri2_engine.set(BraKet::xs_xs); + auto shell2bf = obs.shell2bf(); + const auto& results4 = eri4_engine.results(); + const auto& results2 = eri2_engine.results(); + for (auto s1 = 0; s1 != obs.size(); ++s1) { + for (auto s2 = 0; s2 != obs.size(); ++s2) { + eri4_engine.compute(obs[s1], Shell::unit(), obs[s2], Shell::unit()); + eri2_engine.compute(obs[s1], obs[s2]); + + auto bf1 = shell2bf[s1]; // first basis function in first shell + auto n1 = obs[s1].size(); // number of basis functions in first shell + auto bf2 = shell2bf[s2]; // first basis function in second shell + auto n2 = obs[s2].size(); // number of basis functions in second shell + + // loop over derivative shell sets + for (auto d1 = 0, d12 = 0; d1 != 6; ++d1) { + const auto dd1 = d1 < 3 ? d1 : d1 + 3; + for (auto d2 = d1; d2 != 6; ++d2, ++d12) { + const auto dd2 = d2 < 3 ? d2 : d2 + 3; + const auto dd12 = dd1 * (24 - dd1 - 1) / 2 + dd2; + const auto* buf4 = results4[dd12]; + const auto* buf2 = results2[d12]; + + // this iterates over integrals in the order they are packed in + // array + // ints_shellset + for (auto f1 = 0, f12 = 0; f1 != n1; ++f1) + for (auto f2 = 0; f2 != n2; ++f2, ++f12) + assert(std::abs(buf4[f12] - buf2[f12]) < 1e-12 && + "2nd deriv 2-center ints test failed"); + } + } + } + } + } +#endif + +} From 112f337765445c64b88c2de0bfe437f82fcd3096 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 00:24:17 -0500 Subject: [PATCH 082/182] ci 22 --- .github/workflows/cmake.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 626d3d944..405fc433a 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -189,7 +189,8 @@ jobs: message("Libint2_DIR ${Libint2_DIR}") find_package(Libint2 REQUIRED COMPONENTS eri_c4_d0_l2 CXX_ho) find_package(Threads) # clang does not autolink threads even though we are using std::thread - add_executable(hfpp EXCLUDE_FROM_ALL "${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc") + file(TO_NATIVE_PATH "${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc" _hf_src) + add_executable(hfpp EXCLUDE_FROM_ALL ${_hf_src}) target_link_libraries(hfpp Libint2::cxx Threads::Threads) EOF cmake -S . -B build -D Libint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -D CMAKE_PREFIX_PATH="${{github.workspace}}/installed" -D CMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} From f85b5dff6842ec352dcaf9d0ca910679698b9591 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 00:53:39 -0500 Subject: [PATCH 083/182] ci 23 --- .github/workflows/cmake.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 405fc433a..d158b93db 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -15,7 +15,7 @@ jobs: # cxx: g++-9 - runs-on: ubuntu-20.04 - build_type: Debug + build_type: Release cxx: g++-9 cc: gcc-9 fc: gfortran-9 @@ -189,8 +189,11 @@ jobs: message("Libint2_DIR ${Libint2_DIR}") find_package(Libint2 REQUIRED COMPONENTS eri_c4_d0_l2 CXX_ho) find_package(Threads) # clang does not autolink threads even though we are using std::thread - file(TO_NATIVE_PATH "${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc" _hf_src) - add_executable(hfpp EXCLUDE_FROM_ALL ${_hf_src}) + set(_src1 ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc) + set(_src2 "${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc") + file(TO_NATIVE_PATH "${_src1}" _hf_src1) + file(TO_NATIVE_PATH "${_src2}" _hf_src2) + add_executable(hfpp EXCLUDE_FROM_ALL ${_hf_src1}) target_link_libraries(hfpp Libint2::cxx Threads::Threads) EOF cmake -S . -B build -D Libint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -D CMAKE_PREFIX_PATH="${{github.workspace}}/installed" -D CMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} From 8ac14545a423254e8dd3df590a4e9221981277db Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 01:03:07 -0500 Subject: [PATCH 084/182] ci 24 --- .github/workflows/cmake.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d158b93db..9f6e5786c 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -193,6 +193,10 @@ jobs: set(_src2 "${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc") file(TO_NATIVE_PATH "${_src1}" _hf_src1) file(TO_NATIVE_PATH "${_src2}" _hf_src2) + message("_src1 ${_src1}") + message("_src2 ${_src2}") + message("_hf_src1 ${_hf_src1}") + message("_hf_src2 ${_hf_src2}") add_executable(hfpp EXCLUDE_FROM_ALL ${_hf_src1}) target_link_libraries(hfpp Libint2::cxx Threads::Threads) EOF From bf92f91f96cde904f242a2a4e2ad276393550fa6 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 01:19:42 -0500 Subject: [PATCH 085/182] ci 25 --- .github/workflows/cmake.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9f6e5786c..ace911bb9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -191,13 +191,13 @@ jobs: find_package(Threads) # clang does not autolink threads even though we are using std::thread set(_src1 ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc) set(_src2 "${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc") - file(TO_NATIVE_PATH "${_src1}" _hf_src1) - file(TO_NATIVE_PATH "${_src2}" _hf_src2) message("_src1 ${_src1}") message("_src2 ${_src2}") + file(TO_CMAKE_PATH "${_src1}" _hf_src1) + file(TO_CMAKE_PATH "${_src2}" _hf_src2) message("_hf_src1 ${_hf_src1}") message("_hf_src2 ${_hf_src2}") - add_executable(hfpp EXCLUDE_FROM_ALL ${_hf_src1}) + add_executable(hfpp EXCLUDE_FROM_ALL ${_hf_src2}) target_link_libraries(hfpp Libint2::cxx Threads::Threads) EOF cmake -S . -B build -D Libint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -D CMAKE_PREFIX_PATH="${{github.workspace}}/installed" -D CMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} From e7a46f94cfa52fc42166ad421147084061ba4933 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 01:40:13 -0500 Subject: [PATCH 086/182] ci 26 --- .github/workflows/cmake.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ace911bb9..ed28d1d47 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -200,6 +200,7 @@ jobs: add_executable(hfpp EXCLUDE_FROM_ALL ${_hf_src2}) target_link_libraries(hfpp Libint2::cxx Threads::Threads) EOF + cat CMakeLists.txt cmake -S . -B build -D Libint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -D CMAKE_PREFIX_PATH="${{github.workspace}}/installed" -D CMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} cmake --build build --target hfpp ./build/hfpp ${{github.workspace}}/src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py ${{github.workspace}}/build/libint-2*/features From 978074f60f60788135344e169ff48b9aa4ca8455 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 01:55:13 -0500 Subject: [PATCH 087/182] ci 27 --- .github/workflows/cmake.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ed28d1d47..a3709278c 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -191,13 +191,13 @@ jobs: find_package(Threads) # clang does not autolink threads even though we are using std::thread set(_src1 ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc) set(_src2 "${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc") - message("_src1 ${_src1}") - message("_src2 ${_src2}") - file(TO_CMAKE_PATH "${_src1}" _hf_src1) - file(TO_CMAKE_PATH "${_src2}" _hf_src2) - message("_hf_src1 ${_hf_src1}") - message("_hf_src2 ${_hf_src2}") - add_executable(hfpp EXCLUDE_FROM_ALL ${_hf_src2}) + message("_src1 \$\{_src1\}") + message("_src2 \$\{_src2\}") + file(TO_CMAKE_PATH "\$\{_src1\}" _hf_src1) + file(TO_CMAKE_PATH "\$\{_src2\}" _hf_src2) + message("_hf_src1 \$\{_hf_src1\}") + message("_hf_src2 \$\{_hf_src2\}") + add_executable(hfpp EXCLUDE_FROM_ALL \$\{_hf_src2\}) target_link_libraries(hfpp Libint2::cxx Threads::Threads) EOF cat CMakeLists.txt From a1b9d364bd5d583d19b52318cb479e82504401ba Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 02:03:41 -0500 Subject: [PATCH 088/182] ci 28 --- .github/workflows/cmake.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index a3709278c..609eb77a9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -184,20 +184,20 @@ jobs: cat > CMakeLists.txt < Date: Wed, 2 Feb 2022 02:19:38 -0500 Subject: [PATCH 089/182] ci 29 --- .github/workflows/cmake.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 609eb77a9..0884b48ab 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -189,13 +189,9 @@ jobs: message("Libint2_DIR \${Libint2_DIR}") find_package(Libint2 REQUIRED COMPONENTS eri_c4_d0_l2 CXX_ho) find_package(Threads) # clang does not autolink threads even though we are using std::thread - set(_src1 ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc) set(_src2 "${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc") - message("_src1 \${_src1}") message("_src2 \${_src2}") - file(TO_CMAKE_PATH "\${_src1}" _hf_src1) file(TO_CMAKE_PATH "\${_src2}" _hf_src2) - message("_hf_src1 \${_hf_src1}") message("_hf_src2 \${_hf_src2}") add_executable(hfpp EXCLUDE_FROM_ALL \${_hf_src2}) target_link_libraries(hfpp Libint2::cxx Threads::Threads) From 65fa628a4ee8d7146fcc35d78d2541b6709bece6 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 10:36:51 -0500 Subject: [PATCH 090/182] ci 30 --- .github/workflows/cmake.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 0884b48ab..d21aff65e 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -189,9 +189,7 @@ jobs: message("Libint2_DIR \${Libint2_DIR}") find_package(Libint2 REQUIRED COMPONENTS eri_c4_d0_l2 CXX_ho) find_package(Threads) # clang does not autolink threads even though we are using std::thread - set(_src2 "${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc") - message("_src2 \${_src2}") - file(TO_CMAKE_PATH "\${_src2}" _hf_src2) + file(TO_CMAKE_PATH "${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc" _hf_src2) message("_hf_src2 \${_hf_src2}") add_executable(hfpp EXCLUDE_FROM_ALL \${_hf_src2}) target_link_libraries(hfpp Libint2::cxx Threads::Threads) From 40ee39c3b1bce767ea70dbdbae18961806244791 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 11:39:03 -0500 Subject: [PATCH 091/182] ci 31 --- .github/workflows/cmake.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d21aff65e..3a4ac5dae 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -189,9 +189,10 @@ jobs: message("Libint2_DIR \${Libint2_DIR}") find_package(Libint2 REQUIRED COMPONENTS eri_c4_d0_l2 CXX_ho) find_package(Threads) # clang does not autolink threads even though we are using std::thread - file(TO_CMAKE_PATH "${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc" _hf_src2) - message("_hf_src2 \${_hf_src2}") - add_executable(hfpp EXCLUDE_FROM_ALL \${_hf_src2}) +# file(TO_CMAKE_PATH "${{github.workspace}}\src\lib\libint\tests\hartree-fock\hartree-fock-cpp.cc" _hf_src2) +# message("_hf_src2 \${_hf_src2}") +# add_executable(hfpp EXCLUDE_FROM_ALL \${_hf_src2}) + add_executable(hfpp EXCLUDE_FROM_ALL "../src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc") target_link_libraries(hfpp Libint2::cxx Threads::Threads) EOF cat CMakeLists.txt From 143205ba1506ce828a10a933a8e70f919500de22 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 11:43:34 -0500 Subject: [PATCH 092/182] ci 32 --- .github/workflows/cmake.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 3a4ac5dae..93fdddfc0 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -189,9 +189,6 @@ jobs: message("Libint2_DIR \${Libint2_DIR}") find_package(Libint2 REQUIRED COMPONENTS eri_c4_d0_l2 CXX_ho) find_package(Threads) # clang does not autolink threads even though we are using std::thread -# file(TO_CMAKE_PATH "${{github.workspace}}\src\lib\libint\tests\hartree-fock\hartree-fock-cpp.cc" _hf_src2) -# message("_hf_src2 \${_hf_src2}") -# add_executable(hfpp EXCLUDE_FROM_ALL \${_hf_src2}) add_executable(hfpp EXCLUDE_FROM_ALL "../src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc") target_link_libraries(hfpp Libint2::cxx Threads::Threads) EOF From fae673cb6c71a09b5c1a879a3c33f246a8cf880e Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 12:49:11 -0500 Subject: [PATCH 093/182] ci 33 --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 93fdddfc0..7624d0798 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -193,6 +193,6 @@ jobs: target_link_libraries(hfpp Libint2::cxx Threads::Threads) EOF cat CMakeLists.txt - cmake -S . -B build -D Libint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -D CMAKE_PREFIX_PATH="${{github.workspace}}/installed" -D CMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} + cmake -S . -B build -D CMAKE_CXX_COMPILER=${{ matrix.cfg.cxx }} -D Libint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -D CMAKE_PREFIX_PATH="${{github.workspace}}/installed" -D CMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} cmake --build build --target hfpp ./build/hfpp ${{github.workspace}}/src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py ${{github.workspace}}/build/libint-2*/features From dc5661bb179968dc47cee701123ecfca4c4c0f00 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 13:12:24 -0500 Subject: [PATCH 094/182] ci 34 --- .github/workflows/cmake.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 7624d0798..9e8a3e730 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -183,13 +183,14 @@ jobs: run: | cat > CMakeLists.txt < Date: Wed, 2 Feb 2022 13:59:51 -0500 Subject: [PATCH 095/182] ci 35 --- .github/workflows/cmake.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9e8a3e730..d2c2f3e15 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -154,8 +154,8 @@ jobs: restore-keys: | ${{ matrix.config.name }}-ccache- - - name: Generate+build Libint library (ExternalProject) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type != 'Debug'}} + - 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: | @@ -164,9 +164,9 @@ jobs: cmake --build build --target check-libint2compiler cmake --build build --target install - - name: Generate+build Libint library (FetchContent) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.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=${{ matrix.cfg.build_type }} -DLIBINT_BUILD_LIBRARY_AS_SUBPROJECT=ON $BUILD_CONFIG ${{ matrix.cfg.args }} From 01f42e2d261c386033d5bce54d8f8d0862839fd8 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 15:24:32 -0500 Subject: [PATCH 096/182] ci 36 --- .github/workflows/cmake.yml | 8 ++++---- src/lib/libint/CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d2c2f3e15..17bdfc630 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -170,10 +170,10 @@ jobs: working-directory: ${{github.workspace}} run: | 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 libint-library-export - cmake --build build --target check-libint2compiler - cmake --build build --target check-libint2 - cmake --build build --target install + cmake --build build --target export -j1 + cmake --build build --target check-libint2compiler -j1 + cmake --build build --target check-libint2 -j1 + cmake --build build --target install -j1 #cd src/bin/test_eri && ./stdtests.pl && cd ../../.. - name: Test installed Libint library diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index abd8e8be0..5babe1fa7 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -41,7 +41,7 @@ add_custom_command(OUTPUT "${EXPORT_STAGE_DIR}.tgz" 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}") + COMMAND ${CMAKE_COMMAND} -S "${CMAKE_SOURCE_DIR}" -B "${CMAKE_BINARY_DIR}" -j1) else() add_custom_target(libint-library-export DEPENDS "${EXPORT_STAGE_DIR}.tgz") endif() From 2241f6daf59fdf5cf281bdebc57c67d29639f95e Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 16:01:32 -0500 Subject: [PATCH 097/182] ci 37 --- .github/workflows/cmake.yml | 8 ++++---- src/lib/libint/CMakeLists.txt | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 17bdfc630..f98e51a02 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -170,10 +170,10 @@ jobs: working-directory: ${{github.workspace}} run: | 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 -j1 - cmake --build build --target check-libint2compiler -j1 - cmake --build build --target check-libint2 -j1 - cmake --build build --target install -j1 + cmake --build build --target export --parallel 1 + cmake --build build --target check-libint2compiler --parallel 1 + cmake --build build --target check-libint2 -- parallel 1 + cmake --build build --target install -- parallel 1 #cd src/bin/test_eri && ./stdtests.pl && cd ../../.. - name: Test installed Libint library diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index 5babe1fa7..8c3c52593 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -40,8 +40,10 @@ add_custom_command(OUTPUT "${EXPORT_STAGE_DIR}.tgz" 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}" -j1) + add_custom_target( + libint-library-export + DEPENDS "${EXPORT_STAGE_DIR}.tgz" + COMMAND ${CMAKE_COMMAND} -S "${CMAKE_SOURCE_DIR}" -B "${CMAKE_BINARY_DIR}") else() add_custom_target(libint-library-export DEPENDS "${EXPORT_STAGE_DIR}.tgz") endif() From 7eec4e365da3647645f2d7a5a5034a8c1f18a468 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 17:12:47 -0500 Subject: [PATCH 098/182] ci 38 --- .github/workflows/cmake.yml | 12 ++++++++---- CMakeLists.txt | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index f98e51a02..aa9581213 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -169,11 +169,15 @@ jobs: shell: bash -l {0} working-directory: ${{github.workspace}} run: | + which cmake + cmake --version + which ninja + ninja --version 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 --parallel 1 - cmake --build build --target check-libint2compiler --parallel 1 - cmake --build build --target check-libint2 -- parallel 1 - cmake --build build --target install -- parallel 1 + 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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 31e03fbc4..3a63e6f43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,7 @@ include(options) include(GNUInstallDirs) include(CTest) message(STATUS "Building using CMake ${CMAKE_VERSION}") +message(STATUS "Generating using ${CMAKE_GENERATOR}: ${CMAKE_GENERATOR_INSTANCE}") # <<< General >>> From 7254bb6a1f85efd2329e4796c3287daf0220229b Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 17:24:46 -0500 Subject: [PATCH 099/182] ci 39 --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index aa9581213..06a5d2da2 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -128,7 +128,7 @@ jobs: shell: bash -l {0} run: | conda info - conda install ninja cmake python mpir boost eigen ccache -c conda-forge --yes + conda install ninja cmake=3.18 python mpir boost eigen ccache -c conda-forge --yes conda list - name: Prepare compiler environment for Windows From 6ea4694d30239025fda35042475b34629b440c75 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 21:28:32 -0500 Subject: [PATCH 100/182] ci 40 --- .github/workflows/cmake.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 06a5d2da2..c6beb0cc5 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -128,7 +128,7 @@ jobs: shell: bash -l {0} run: | conda info - conda install ninja cmake=3.18 python mpir boost eigen ccache -c conda-forge --yes + conda install ninja cmake python mpir boost eigen ccache -c conda-forge --yes conda list - name: Prepare compiler environment for Windows @@ -155,24 +155,18 @@ jobs: ${{ matrix.config.name }}-ccache- - name: Generate+build Libint library (ExternalProject, cplr tests) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Debug'}} + 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=${{ matrix.cfg.build_type }} $BUILD_CONFIG ${{ matrix.cfg.args }} - cmake --build build - cmake --build build --target check-libint2compiler - cmake --build build --target install + cmake --build build --target library check install - name: Generate+build Libint library (FetchContent, full tests) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type != 'Debug'}} + if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Debug'}} shell: bash -l {0} working-directory: ${{github.workspace}} run: | - which cmake - cmake --version - which ninja - ninja --version 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 From 308da043c14e588782fe69fed6517df45b08b7cc Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 23:00:32 -0500 Subject: [PATCH 101/182] ci 41 --- .github/workflows/cmake.yml | 8 ++++---- src/lib/libint/tests/unit/test-2body.cc | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index c6beb0cc5..70eb56580 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -15,7 +15,7 @@ jobs: # cxx: g++-9 - runs-on: ubuntu-20.04 - build_type: Release + build_type: Debug cxx: g++-9 cc: gcc-9 fc: gfortran-9 @@ -40,7 +40,7 @@ jobs: # -DCMAKE_CXX_FLAGS="-D_=1" - runs-on: windows-2022 - build_type: Release + build_type: Debug cxx: clang-cl cc: clang-cl args: > @@ -155,7 +155,7 @@ jobs: ${{ matrix.config.name }}-ccache- - name: Generate+build Libint library (ExternalProject, cplr tests) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type != 'Debug'}} + if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Debug'}} shell: bash -l {0} working-directory: ${{github.workspace}} run: | @@ -163,7 +163,7 @@ jobs: cmake --build build --target library check install - name: Generate+build Libint library (FetchContent, full tests) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Debug'}} + if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type != 'Debug'}} shell: bash -l {0} working-directory: ${{github.workspace}} run: | 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{ From 72a0cfe5ac911e51a0eb828273fad5af280e84fb Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 2 Feb 2022 23:41:11 -0500 Subject: [PATCH 102/182] ci 42 --- src/lib/libint/CMakeLists.txt.export | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 3c65aaab1..a13233994 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -243,7 +243,7 @@ if (NOT BUILD_SHARED_LIBS OR LIBINT2_BUILD_SHARED_AND_STATIC_LIBS) endif() # if building CXX API, make an object lib needed for non-header-only version -if (REQUIRE_CXX_API) +if (REQUIRE_CXX_API AND NOT MSVC) add_library(int-cxx-obj OBJECT src/engine.cpp) target_compile_definitions( @@ -318,6 +318,7 @@ if (BUILD_SHARED_LIBS) endif() # now make the compiled library + if (NOT MSVC) add_library(int-cxx-shared SHARED $) set_target_properties( @@ -330,6 +331,7 @@ if (BUILD_SHARED_LIBS) ) target_link_libraries(int-cxx-shared INTERFACE int-cxx-headeronly-shared) + endif() endif() endif() @@ -375,6 +377,7 @@ if (BUILD_STATIC_LIBS) endif() # now make the compiled library + if (NOT MSVC) add_library(int-cxx-static STATIC $) set_target_properties( @@ -385,6 +388,7 @@ if (BUILD_STATIC_LIBS) ) target_link_libraries(int-cxx-static INTERFACE int-cxx-headeronly-static) + endif() endif(REQUIRE_CXX_API) endif() @@ -396,13 +400,17 @@ if (BUILD_SHARED_LIBS) add_library(${L2}::int2 ALIAS int-shared) if (REQUIRE_CXX_API) add_library(${L2}::cxx ALIAS int-cxx-headeronly-shared) + if (NOT MSVC) add_library(${L2}::int2-cxx ALIAS int-cxx-shared) + endif() endif() elseif (BUILD_STATIC_LIBS) add_library(${L2}::int2 ALIAS int-static) if (REQUIRE_CXX_API) add_library(${L2}::cxx ALIAS int-cxx-headeronly-static) + if (NOT MSVC) add_library(${L2}::int2-cxx ALIAS int-cxx-static) + endif() endif() endif() @@ -542,11 +550,11 @@ install( #target_include_directories(int-obj PRIVATE ${PROJECT_BINARY_DIR}) if (BUILD_SHARED_LIBS) - if (TARGET int-cxx-headeronly-shared AND TARGET int-cxx-shared) + if (TARGET int-cxx-headeronly-shared) # AND TARGET int-cxx-shared) install( TARGETS int-shared - int-cxx-shared + #int-cxx-shared int-cxx-headeronly-shared EXPORT shared_set RUNTIME @@ -603,11 +611,11 @@ if (BUILD_SHARED_LIBS) endif() if (BUILD_STATIC_LIBS) - if (TARGET int-cxx-headeronly-static AND TARGET int-cxx-static) + if (TARGET int-cxx-headeronly-static) # AND TARGET int-cxx-static) install( TARGETS int-static - int-cxx-static + #int-cxx-static int-cxx-headeronly-static EXPORT static_set RUNTIME From 5e45bfb686eac122c2eb403a5af8e8c315d5fa79 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 3 Feb 2022 01:17:35 -0500 Subject: [PATCH 103/182] ci 43 --- .github/workflows/cmake.yml | 10 +++++----- CMakeLists.txt | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 70eb56580..0a2ec2b3d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -15,7 +15,7 @@ jobs: # cxx: g++-9 - runs-on: ubuntu-20.04 - build_type: Debug + build_type: Release cxx: g++-9 cc: gcc-9 fc: gfortran-9 @@ -40,7 +40,7 @@ jobs: # -DCMAKE_CXX_FLAGS="-D_=1" - runs-on: windows-2022 - build_type: Debug + build_type: Release cxx: clang-cl cc: clang-cl args: > @@ -155,7 +155,7 @@ jobs: ${{ matrix.config.name }}-ccache- - name: Generate+build Libint library (ExternalProject, cplr tests) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Debug'}} + if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type != 'Debug'}} shell: bash -l {0} working-directory: ${{github.workspace}} run: | @@ -163,7 +163,7 @@ jobs: cmake --build build --target library check install - name: Generate+build Libint library (FetchContent, full tests) - if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type != 'Debug'}} + if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Debug'}} shell: bash -l {0} working-directory: ${{github.workspace}} run: | @@ -192,6 +192,6 @@ jobs: target_link_libraries(hfpp Libint2::cxx Threads::Threads) EOF cat CMakeLists.txt - cmake -S . -B build -D CMAKE_CXX_COMPILER=${{ matrix.cfg.cxx }} -D Libint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -D CMAKE_PREFIX_PATH="${{github.workspace}}/installed" -D CMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} + cmake -S . -B build -DCMAKE_CXX_COMPILER=${{ matrix.cfg.cxx }} -DCMAKE_C_COMPILER=${{ matrix.cfg.cc }} -D Libint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -D CMAKE_PREFIX_PATH="${{github.workspace}}/installed" -D CMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} cmake --build build --target hfpp ./build/hfpp ${{github.workspace}}/src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py ${{github.workspace}}/build/libint-2*/features diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a63e6f43..dcd560cdd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -207,8 +207,8 @@ 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_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_print(ENABLE_MPFR "Use GNU MPFR library for high-precision testing (EXPERTS ONLY)" OFF) # next one defined by `include(CTest)` From 99aea66344afe43514e97bd5083bfd3b06b044f5 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 3 Feb 2022 02:34:40 -0500 Subject: [PATCH 104/182] ci 44 --- include/libint2/basis.h.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/libint2/basis.h.in b/include/libint2/basis.h.in index bfe65df77..df5e9c87c 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("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 From c6abf4c6cdfb69c5428e40a470a9b4e6a0d45955 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 3 Feb 2022 11:11:14 -0500 Subject: [PATCH 105/182] ci 45 --- .github/workflows/cmake.yml | 5 +++-- include/libint2/basis.h.in | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 0a2ec2b3d..c51b8f914 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -160,7 +160,8 @@ jobs: working-directory: ${{github.workspace}} run: | cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} $BUILD_CONFIG ${{ matrix.cfg.args }} - cmake --build build --target library check install + cmake --build build --target library check-libint2compiler install + #cmake --build build --target library check install - name: Generate+build Libint library (FetchContent, full tests) if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Debug'}} @@ -192,6 +193,6 @@ jobs: target_link_libraries(hfpp Libint2::cxx Threads::Threads) EOF cat CMakeLists.txt - cmake -S . -B build -DCMAKE_CXX_COMPILER=${{ matrix.cfg.cxx }} -DCMAKE_C_COMPILER=${{ matrix.cfg.cc }} -D Libint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -D CMAKE_PREFIX_PATH="${{github.workspace}}/installed" -D CMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} + cmake -S . -B build -DCMAKE_CXX_COMPILER=${{ matrix.cfg.cxx }} -DCMAKE_C_COMPILER=${{ matrix.cfg.cc }} -DLibint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} -DCMAKE_CXX_FLAGS="/std:c11" cmake --build build --target hfpp ./build/hfpp ${{github.workspace}}/src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py ${{github.workspace}}/build/libint-2*/features diff --git a/include/libint2/basis.h.in b/include/libint2/basis.h.in index df5e9c87c..6c15714c2 100644 --- a/include/libint2/basis.h.in +++ b/include/libint2/basis.h.in @@ -449,7 +449,7 @@ namespace libint2 { #ifdef _MSC_VER std::string locale_name = std::string("en-US") #else - std::string locale_name = std::string("en_US") + std::string locale_name = std::string("POSIX") // "en_US" #endif ) { From c1e8fa68c3137e98cacce2d4518f78ecd5333d60 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 3 Feb 2022 12:15:14 -0500 Subject: [PATCH 106/182] ci 46 --- .github/workflows/cmake.yml | 2 +- include/libint2/util/cxxstd.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index c51b8f914..9d11b86a4 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -193,6 +193,6 @@ jobs: target_link_libraries(hfpp Libint2::cxx Threads::Threads) EOF cat CMakeLists.txt - cmake -S . -B build -DCMAKE_CXX_COMPILER=${{ matrix.cfg.cxx }} -DCMAKE_C_COMPILER=${{ matrix.cfg.cc }} -DLibint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} -DCMAKE_CXX_FLAGS="/std:c11" + cmake -S . -B build -DCMAKE_CXX_COMPILER=${{ matrix.cfg.cxx }} -DCMAKE_C_COMPILER=${{ matrix.cfg.cc }} -DLibint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} #-DCMAKE_CXX_FLAGS="/std:c11" cmake --build build --target hfpp ./build/hfpp ${{github.workspace}}/src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py ${{github.workspace}}/build/libint-2*/features diff --git a/include/libint2/util/cxxstd.h b/include/libint2/util/cxxstd.h index c57e4355f..03daa8668 100644 --- a/include/libint2/util/cxxstd.h +++ b/include/libint2/util/cxxstd.h @@ -31,8 +31,15 @@ # define LIBINT2_CPLUSPLUS_STD 2011 #elif __cplusplus >= 199711L # define LIBINT2_CPLUSPLUS_STD 1998 +#elif defined(_MSC_VER) && __cplusplus == 199711L && _MSVC_LANG >= 201402L && _MSC_VER >= 1910 +# define LIBINT2_CPLUSPLUS_STD 2014 // really, 2017 +#elif defined(_MSC_VER) && __cplusplus == 199711L && _MSVC_LANG >= 201402L +# define LIBINT2_CPLUSPLUS_STD 2014 +#elif defined(_MSC_VER) && __cplusplus == 199711L // questionable check +# define LIBINT2_CPLUSPLUS_STD 2011 #else -# define LIBINT2_CPLUSPLUS_STD 0 // unknown standard +# define LIBINT2_CPLUSPLUS_STD 2011 +//# define LIBINT2_CPLUSPLUS_STD 0 // unknown standard #endif // workaround: standard Intel compiler (not INDE) is not standard conforming From cf044af38c59dd25f432f57c88932b5982886273 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 3 Feb 2022 12:34:46 -0500 Subject: [PATCH 107/182] ci 47 --- .github/workflows/cmake.yml | 3 ++- include/libint2/util/cxxstd.h | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9d11b86a4..eaba600fa 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -160,7 +160,8 @@ jobs: working-directory: ${{github.workspace}} run: | cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} $BUILD_CONFIG ${{ matrix.cfg.args }} - cmake --build build --target library check-libint2compiler install + cmake --build build --target library install + #cmake --build build --target library check-libint2compiler install #cmake --build build --target library check install - name: Generate+build Libint library (FetchContent, full tests) diff --git a/include/libint2/util/cxxstd.h b/include/libint2/util/cxxstd.h index 03daa8668..2a9ed545f 100644 --- a/include/libint2/util/cxxstd.h +++ b/include/libint2/util/cxxstd.h @@ -25,18 +25,18 @@ # error "Libint2 requires a C++ compiler" #endif -#if __cplusplus >= 201402L -# define LIBINT2_CPLUSPLUS_STD 2014 -#elif __cplusplus >= 201103L -# define LIBINT2_CPLUSPLUS_STD 2011 -#elif __cplusplus >= 199711L -# define LIBINT2_CPLUSPLUS_STD 1998 -#elif defined(_MSC_VER) && __cplusplus == 199711L && _MSVC_LANG >= 201402L && _MSC_VER >= 1910 +#if defined(_MSC_VER) && __cplusplus == 199711L && _MSVC_LANG >= 201402L && _MSC_VER >= 1910 # define LIBINT2_CPLUSPLUS_STD 2014 // really, 2017 #elif defined(_MSC_VER) && __cplusplus == 199711L && _MSVC_LANG >= 201402L # define LIBINT2_CPLUSPLUS_STD 2014 #elif defined(_MSC_VER) && __cplusplus == 199711L // questionable check # define LIBINT2_CPLUSPLUS_STD 2011 +#elif __cplusplus >= 201402L +# define LIBINT2_CPLUSPLUS_STD 2014 +#elif __cplusplus >= 201103L +# define LIBINT2_CPLUSPLUS_STD 2011 +#elif __cplusplus >= 199711L +# define LIBINT2_CPLUSPLUS_STD 1998 #else # define LIBINT2_CPLUSPLUS_STD 2011 //# define LIBINT2_CPLUSPLUS_STD 0 // unknown standard From 03f6721e79705d3135f3f3de3d3e6b2d19b809d1 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 3 Feb 2022 13:46:47 -0500 Subject: [PATCH 108/182] ci 48 --- .github/workflows/cmake.yml | 2 +- include/libint2/diis.h | 4 ++++ include/libint2/engine.impl.h | 4 ++++ include/libint2/lcao/molden.h | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index eaba600fa..471c9a703 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -194,6 +194,6 @@ jobs: target_link_libraries(hfpp Libint2::cxx Threads::Threads) EOF cat CMakeLists.txt - cmake -S . -B build -DCMAKE_CXX_COMPILER=${{ matrix.cfg.cxx }} -DCMAKE_C_COMPILER=${{ matrix.cfg.cc }} -DLibint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} #-DCMAKE_CXX_FLAGS="/std:c11" + cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=${{ matrix.cfg.cxx }} -DCMAKE_C_COMPILER=${{ matrix.cfg.cc }} -DLibint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} #-DCMAKE_CXX_FLAGS="/std:c11" cmake --build build --target hfpp ./build/hfpp ${{github.workspace}}/src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py ${{github.workspace}}/build/libint-2*/features 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 { From 6b8f3b90a2ba5ce723be473ffaf8dca9f69d857c Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 3 Feb 2022 17:20:02 -0500 Subject: [PATCH 109/182] ci 49 --- .github/workflows/cmake.yml | 4 ++++ src/lib/libint/CMakeLists.txt.export | 23 ++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 471c9a703..b4db5f19e 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -164,6 +164,10 @@ jobs: #cmake --build build --target library check-libint2compiler install #cmake --build build --target library check install + # Note: FetchContent sequence broken on Windows+Ninja + # This is known issue https://gitlab.kitware.com/cmake/cmake/-/issues/20274 + # that should be ok with CMake 3.20+ and Ninja 1.10.2+ but broken c. Feb 2022 + - 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} diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index a13233994..ecae80ea3 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -277,6 +277,17 @@ endif() if (BUILD_SHARED_LIBS) add_library(int-shared SHARED $) + if(MSVC) + # MSVC does not include constants, unless _USE_MATH_DEFINES is defined. + target_compile_definitions( + int-shared + PUBLIC + _USE_MATH_DEFINES + "/EHsc" + ) + # Set the exception handling model + endif() + target_compile_features(int-shared INTERFACE "cxx_std_11") set_target_properties( @@ -340,6 +351,16 @@ if (BUILD_STATIC_LIBS) target_compile_features(int-static INTERFACE "cxx_std_11") + if(MSVC) + # MSVC does not include constants, unless _USE_MATH_DEFINES is defined. + target_compile_definitions( + int-static + PUBLIC + _USE_MATH_DEFINES + "/EHsc" + ) + endif() + set_target_properties( int-static PROPERTIES @@ -708,7 +729,7 @@ if (BUILD_SHARED_LIBS) if(ENABLE_FORTRAN) install( EXPORT fshared_set - FILE "${pnv}-targets-shared-fortran.cmake" + FILE "${pnv}-targets-fortran-shared.cmake" NAMESPACE "${L2}::" DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} COMPONENT ${L2}_Development_Fortran From 1479e39a3af60556ce70b241dfa6ff8949f4fad9 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 3 Feb 2022 21:33:44 -0500 Subject: [PATCH 110/182] ci 50 --- src/lib/libint/CMakeLists.txt.export | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index ecae80ea3..28a428ac5 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -279,12 +279,8 @@ if (BUILD_SHARED_LIBS) if(MSVC) # MSVC does not include constants, unless _USE_MATH_DEFINES is defined. - target_compile_definitions( - int-shared - PUBLIC - _USE_MATH_DEFINES - "/EHsc" - ) + target_compile_definitions(int-shared PUBLIC _USE_MATH_DEFINES) + target_compile_options(int-shared PUBLIC "/EHsc") # Set the exception handling model endif() @@ -353,12 +349,9 @@ if (BUILD_STATIC_LIBS) if(MSVC) # MSVC does not include constants, unless _USE_MATH_DEFINES is defined. - target_compile_definitions( - int-static - PUBLIC - _USE_MATH_DEFINES - "/EHsc" - ) + target_compile_definitions(int-shared PUBLIC _USE_MATH_DEFINES) + target_compile_options(int-shared PUBLIC "/EHsc") + # Set the exception handling model endif() set_target_properties( From 8c4ca00a09e904b3ed95a461219bfe82fd6e90e8 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 3 Feb 2022 21:42:41 -0500 Subject: [PATCH 111/182] ci 51 --- src/lib/libint/CMakeLists.txt.export | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 28a428ac5..1a9733cf9 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -349,8 +349,8 @@ if (BUILD_STATIC_LIBS) if(MSVC) # MSVC does not include constants, unless _USE_MATH_DEFINES is defined. - target_compile_definitions(int-shared PUBLIC _USE_MATH_DEFINES) - target_compile_options(int-shared PUBLIC "/EHsc") + target_compile_definitions(int-static PUBLIC _USE_MATH_DEFINES) + target_compile_options(int-static PUBLIC "/EHsc") # Set the exception handling model endif() From 2d267507db4438c0c4134fc926bdc29d7cb3462b Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 3 Feb 2022 22:35:58 -0500 Subject: [PATCH 112/182] ci 52 --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index b4db5f19e..7df9acf2d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -200,4 +200,4 @@ jobs: cat CMakeLists.txt cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=${{ matrix.cfg.cxx }} -DCMAKE_C_COMPILER=${{ matrix.cfg.cc }} -DLibint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} #-DCMAKE_CXX_FLAGS="/std:c11" cmake --build build --target hfpp - ./build/hfpp ${{github.workspace}}/src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ${{github.workspace}}/src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py ${{github.workspace}}/build/libint-2*/features + ./build/hfpp ../src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ../src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py ../build/libint-2*/features From 38a38eba561d66647ed49e0e9a8de6c488e7ce7f Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 4 Feb 2022 00:22:57 -0500 Subject: [PATCH 113/182] ci 53 --- .github/workflows/cmake.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 7df9acf2d..aacaed154 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -161,6 +161,7 @@ jobs: run: | cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} $BUILD_CONFIG ${{ matrix.cfg.args }} cmake --build build --target library install + cd build && echo "ARTIFACT=`ls -1 libint*tgz`" >> $GITHUB_ENV #cmake --build build --target library check-libint2compiler install #cmake --build build --target library check install @@ -178,7 +179,15 @@ jobs: 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: 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: ${{ steps.skip_check.outputs.should_skip != 'true' }} @@ -187,17 +196,17 @@ jobs: run: | cat > CMakeLists.txt < Date: Fri, 4 Feb 2022 00:43:35 -0500 Subject: [PATCH 114/182] ci 54 --- .github/workflows/cmake.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index aacaed154..9ac1d18f5 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -207,6 +207,13 @@ jobs: target_link_libraries(hfpp Libint2::cxx Threads::Threads) EOF cat CMakeLists.txt - cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=${{ matrix.cfg.cxx }} -DCMAKE_C_COMPILER=${{ matrix.cfg.cc }} -DLibint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" #-DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} + cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} -DLibint2_DIR="${{github.workspace}}\installed\lib\cmake\libint2" -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" cmake --build build --target hfpp ./build/hfpp ../src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ../src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py ../build/libint-2*/features + +# Notes: +# * Windows w/CMAKE_BUILD_TYPE=Debug gives errors like: +# ``` +# In file included from D:\a\libint\libint\installed\include\libint2/diis.h:368: +# D:\a\libint\libint\installed\include\libint2/./engine.h(471,3): error: constructor for 'libint2::Engine' must explicitly initialize the member 'targets_' which does not have a default constructor +# ``` From 33931be231444b990eda77c7696e519a698f5775 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 4 Feb 2022 01:34:03 -0500 Subject: [PATCH 115/182] ci 55 --- .github/workflows/cmake.yml | 18 +++++++++++------- src/lib/libint/CMakeLists.txt.export | 4 ++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9ac1d18f5..8d34c93d3 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -43,8 +43,8 @@ jobs: build_type: Release cxx: clang-cl cc: clang-cl - args: > - -DCMAKE_C_COMPILER=clang-cl + args: "" #> + #-DCMAKE_C_COMPILER=clang-cl # -DCMAKE_CXX_FLAGS="-D_=1" @@ -56,6 +56,7 @@ jobs: runs-on: ${{ matrix.cfg.runs-on }} env: CXX : ${{ matrix.cfg.cxx }} + CC : ${{ matrix.cfg.cc }} CCACHE_DIR : ${{github.workspace}}/build/.ccache CCACHE_COMPRESS : true CCACHE_COMPRESSLEVEL : 6 @@ -165,10 +166,6 @@ jobs: #cmake --build build --target library check-libint2compiler install #cmake --build build --target library check install - # Note: FetchContent sequence broken on Windows+Ninja - # This is known issue https://gitlab.kitware.com/cmake/cmake/-/issues/20274 - # that should be ok with CMake 3.20+ and Ninja 1.10.2+ but broken c. Feb 2022 - - 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} @@ -212,8 +209,15 @@ jobs: ./build/hfpp ../src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ../src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py ../build/libint-2*/features # Notes: -# * Windows w/CMAKE_BUILD_TYPE=Debug gives errors like: +# * Windows with CMAKE_BUILD_TYPE=Debug gives errors like: # ``` # In file included from D:\a\libint\libint\installed\include\libint2/diis.h:368: # D:\a\libint\libint\installed\include\libint2/./engine.h(471,3): error: constructor for 'libint2::Engine' must explicitly initialize the member 'targets_' which does not have a default constructor # ``` +# * Windows+Ninja with FetchContent sequence gives errors like: +# ``` +# "ninja: error: failed recompaction: Permission denied" +# ``` +# This is known issue https://gitlab.kitware.com/cmake/cmake/-/issues/20274 +# that should be ok with CMake 3.20+ and Ninja 1.10.2+ (which we have) but broken c. Feb 2022 +# diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 1a9733cf9..77b1ad219 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -280,8 +280,8 @@ if (BUILD_SHARED_LIBS) if(MSVC) # MSVC does not include constants, unless _USE_MATH_DEFINES is defined. target_compile_definitions(int-shared PUBLIC _USE_MATH_DEFINES) - target_compile_options(int-shared PUBLIC "/EHsc") # Set the exception handling model + target_compile_options(int-shared PUBLIC "/EHsc") endif() target_compile_features(int-shared INTERFACE "cxx_std_11") @@ -350,8 +350,8 @@ if (BUILD_STATIC_LIBS) if(MSVC) # MSVC does not include constants, unless _USE_MATH_DEFINES is defined. target_compile_definitions(int-static PUBLIC _USE_MATH_DEFINES) - target_compile_options(int-static PUBLIC "/EHsc") # Set the exception handling model + target_compile_options(int-static PUBLIC "/EHsc") endif() set_target_properties( From aee79c9a5f4df0cb2e220176c95567f3b90a6ab7 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 4 Feb 2022 01:55:44 -0500 Subject: [PATCH 116/182] ci 56 --- .github/workflows/cmake.yml | 7 ++----- src/lib/libint/CMakeLists.txt.export | 6 ------ 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 8d34c93d3..05d5c31cf 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -193,18 +193,15 @@ jobs: run: | cat > CMakeLists.txt <>> -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) From dd91e6b145dd54b7cac16a76f999aea65ef96661 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 4 Feb 2022 02:41:08 -0500 Subject: [PATCH 117/182] ci 57 --- .github/workflows/cmake.yml | 10 +++++----- src/lib/libint/CMakeLists.txt.export | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 05d5c31cf..cbcc85fa1 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -193,17 +193,17 @@ jobs: run: | cat > CMakeLists.txt <>> - configure_file(include/libint2/config2.h.cmake.in include/libint2/config2.h @ONLY) include(srclist.cmake) From 46a6f0842b4b1691f52db9288aa78c72eb1640f9 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 4 Feb 2022 02:59:52 -0500 Subject: [PATCH 118/182] ci 58 --- .github/workflows/cmake.yml | 2 - CMakeLists.txt | 3 +- .../hartree-fock/hartree-fock-cpp-validate.py | 165 -- .../tests/hartree-fock/hartree-fock-cpp.cc | 2538 ----------------- 4 files changed, 2 insertions(+), 2706 deletions(-) delete mode 100644 src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py delete mode 100644 src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index cbcc85fa1..f2c53fd18 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -2,8 +2,6 @@ name: CI on: [push, pull_request] -#env: - jobs: build: strategy: diff --git a/CMakeLists.txt b/CMakeLists.txt index dcd560cdd..2bc447521 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,7 +267,8 @@ include(CheckFunctionExists) include(int_orderings) include(int_am) -check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN) +#check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN) +set(HAVE_POSIX_MEMALIGN 1) if (HAVE_POSIX_MEMALIGN) set(LIBINT2_ALIGN_SIZE "0" CACHE STRING "(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") endif() diff --git a/src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py b/src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py deleted file mode 100644 index a94dd8d3a..000000000 --- a/src/lib/libint/tests/hartree-fock/hartree-fock-cpp-validate.py +++ /dev/null @@ -1,165 +0,0 @@ -from __future__ import print_function -import sys, re, math, os - -def pat_numbers(n): - result = '' - for i in range(n): - result += '\s*([+-e\d.]+)' - return result - -def validate(label, data, refdata, tolerance, textline): - ok = True - ndata = len(refdata) - for i in range(ndata): - datum = float(data[i]) - refdatum = refdata[i] - if (math.fabs(refdatum - datum) > tolerance): - ok = False - print(label, "check: failed\nreference:", refdata, "\nactual:", textline) - break - if (ok): print(label, "check: passed") - return ok - -assert(len(sys.argv) > 1) -# first arg is the path to MakeVars.features -path_to_libfeatures = sys.argv[1] -# second arg is the input file, if missing read sys.stdin -try: - instr = open(sys.argv[2]) if len(sys.argv) > 2 else sys.stdin -except Exception as e: - sys.exit(2) - -if os.path.exists(path_to_libfeatures): - # define boolean constants used in MakeVars.features - no = False - yes = True - exec(open(path_to_libfeatures).read()) -else: - sys.exit(2) - -# ignore test if ERI_MAX_AM is too low -if LIBINT_ERI_MAX_AM<2: - sys.exit(0) - -eref = [-76.003354058439] -etol = 5e-12 - -muref = [-0.263282355191187, -0.0912036831854911, -0.105312942076475] -mutol = 1e-9 - -Qref = [-7.01719638074453, 0.024624345507934, -0.576201299024159, - -8.04716669024124, 0.638204907990955, -6.35134519242917 ] -Qtol = 1e-8 - -smuref = [-muref[1]/2, muref[2], -muref[0]/2] -smutol = 1e-9 - -sQref = [Qref[1]/4, -Qref[4]/2, (2*Qref[5] - Qref[0] - Qref[3])/4, - -Qref[2]/2, (Qref[0] - Qref[3])/8 ] -sQtol = 1e-8 - -F1ref = [-5.43569555903312, -1.88298017654395, -2.17427822361352, - 3.47022732536532, -2.96798871167808, 2.59189820350226, - 1.9654682336678, 4.85096888822203, -0.417619979888738 ] -F1tol = 1e-9 -F1ok = False if LIBINT_ONEBODY_DERIV>0 else True - -FPref = [ 0.355265310323155, 0.123067513529209, 0.142106124129298, - -0.224258642015539, 0.180741977786854, -0.164305035772324, - -0.131006668307617, -0.303809491316068, 0.0221989116430271 ] -FPtol = 1e-9 -FPok = False if LIBINT_ONEBODY_DERIV>0 else True - -F2ref = [ 2.95100851670393, 1.02225933689958, 1.18040340668181, - -1.89116113654409, 1.64868682617684, -1.42151545972338, - -1.05984738015984, -2.67094616307642, 0.241112053041571 ] -F2tol = 1e-9 -F2ok = False if LIBINT_ERI_DERIV>0 else True - -FNref = [ 2.01500148332517 , 0.698016989289171, 0.806000593330069, - -1.28187870168764 , 1.07670120707691 , -0.951756216715147, - -0.733122781637531, -1.77471819636609 , 0.145755623385078 ] -FNtol = 1e-10 -FNok = False if LIBINT_ONEBODY_DERIV>0 and LIBINT_ERI_DERIV>0 else True - -Fref = [ -0.114420248680859, -0.0396363368259882, -0.0457680994723476, - 0.0729288451180514, -0.0618587006374771, 0.0543214912914121, - 0.0414914035628126, 0.101495037463456, -0.00855339181906306 ] -Ftol = 1e-9 -Fok = False if LIBINT_ONEBODY_DERIV>0 and LIBINT_ERI_DERIV>0 else True - -H1ref = [ 3.54760842822125, 0.0561425790590885, -1.84088034418252, -0.887601426360438, -2.17549130368644, 1.98344832758524, -2.66000700186171, 2.11934872462735, -0.142567983402711, 0.355853985722548, 2.00292709856151, -2.17850638711514, -1.77309201081378, -1.61619662181537, 2.12236380805605, 1.41723802509125, -0.386730476746138, 5.69831976160228, 1.98431870719983, -1.61468908010102, -2.14019765060108, -0.143438363017304, -0.38823801846049, -3.55812211100127, 0.904263134266358, 2.18335388755013, -1.98924643233292, -0.0166617079059194, -0.00484750043498585, 0.00492772513309295, 1.75328800656853, 1.63118422308913, -0.00786258386369225, 0.0198040042452449, -0.0164951429881064, 2.15669050290334, 0.00579810474768649, -0.0149876012737541, -0.0164928523022598, 2.67666870976763, -2.11450122419236, 0.137640258269618, -1.43704202933649, 0.403225619734244, 3.57461496330354 ] -H1tol = 1e-9 -H1ok = False if LIBINT_ONEBODY_DERIV>1 else True - -HPref = [ -0.373657119664361, -0.00133454389521286, 0.0913757616853391, 0.144293176019879, 0.103810096183052, -0.0967303414175233, 0.229363943644482, -0.102475552287839, 0.00535457973218418, -0.221600106461453, -0.0970957473238979, 0.103810096183052, 0.187363744093183, 0.0780172520149254, -0.102475552287839, 0.0342363623684173, 0.0190784953089725, -0.481921134987926, -0.0967303414175233, 0.0780172520149254, 0.206932260444167, 0.00535457973218418, 0.0190784953089725, 0.27498887454376, -0.141868433944075, -0.102526043925858, 0.096303732812767, -0.00242474207580482, -0.00128405225719423, 0.000426608604756398, -0.191255819949221, -0.0755194237363812, -0.00128405225719423, 0.00389207585603787, -0.00249782827854418, -0.205330014292075, 0.000426608604756397, -0.00249782827854418, -0.00160224615209187, -0.226939201568677, 0.103759604545033, -0.00578118833694058, -0.038128438224455, -0.0165806670304283, -0.273386628391668 ] -HPtol = 1e-9 -HPok = False if LIBINT_ONEBODY_DERIV>1 else True - -H2ref = [ -2.97603189152785, -0.04203457482293, 0.898032292915088, 1.06445776362688, 1.08388172281076, -0.967617771471307, 1.91157412790108, -1.04184714798783, 0.0695854785562199, -1.3547383073865, -1.00051785461617, 1.01230086799738, 1.43977388154118, 0.775813430173996, -0.970266293174445, -0.0850355741545849, 0.224704424442172, -4.00998703146547, -0.946954158573641, 0.811603857580693, 1.66614697002347, 0.0489218656585546, 0.188913997035478, 2.34384006144209, -1.07351307118258, -1.0520106170714, 0.957147912300498, 0.00905530755570372, 0.0397097490740273, -0.0101937537268573, -1.43185263066289, -0.799836089947826, -0.0318711057393559, -0.00792125087828533, -0.0117677676328675, -1.67096353575741, 0.0104698591708088, 0.024022659773826, 0.004816565733943, -1.92062943545679, 1.0021373989138, -0.0593917248293631, 0.0929568250328693, -0.212936656809304, -2.34865662717603 ] -H2tol = 1e-9 -H2ok = False if LIBINT_ERI_DERIV>1 else True - -HNref = [ -0.0951342315737215, 0.00935257129239186, 0.840399911304933, -0.357531998589061, 0.977636861834156, -0.906318892903572, 0.452666230162782, -0.986989433126548, 0.0659189815986388, 1.20846783390926, -0.858405092966087, 0.977636861834156, 0.124944488922027, 0.709863445763144, -0.986989433126549, -1.33341232283129, 0.148541647202943, -1.11333360233554, -0.906318892903572, 0.709863445763144, 0.232587509667034, 0.0659189815986388, 0.148541647202943, 0.880746092668508, 0.331757531616028, -0.99149148862787, 0.91165154124282, 0.0257744669730324, 0.0138546267937132, -0.00533264833924809, -0.0813945274848341, -0.737572699350571, 0.0138546267937132, -0.0435499614371927, 0.0277092535874264, -0.250363004131194, -0.00533264833924809, 0.0277092535874264, 0.0177754944641603, -0.478440697135815, 0.973134806332835, -0.0605863332593907, 1.37696228426848, -0.176250900790369, -0.898521587132668 ] -HNtol = 1e-10 -HNok = False if LIBINT_ONEBODY_DERIV>1 and LIBINT_ERI_DERIV>1 else True - -Href = [ 0.102785185455314, 0.0221260316333375, -0.0110723782771648, -0.0363824853027409, -0.0101626228584681, 0.012781321792833, -0.0664027001533642, -0.0119634087748708, -0.00170894351566768, -0.0120165942161412, 0.0469084036553551, -0.0847585611005566, -0.0210098962573883, -0.0525024938633059, 0.0626325294672223, 0.0330264904737867, 0.0055940902079491, 0.0930779928133423, 0.0343153143050929, -0.0152045247422558, -0.0345309104664071, -0.0232429360279265, -0.0317038789130969, -0.0585470823469183, 0.0206391607557284, 0.0373257379249965, -0.0241432459768363, 0.015743324547012, 0.0474328231755604, -0.010172068328256, 0.0487850284715841, 0.0182560100543473, -0.0271631150665291, -0.0277751322141953, -0.00305148531209163, 0.0300339487226562, 0.0113619241840036, 0.0342464838089542, 0.00449696174375165, 0.0506593756063487, -0.0354694144006902, 0.0118810118439231, -0.005251358259593, -0.00254260489585742, 0.0540501206031722 ] -Htol = 1e-9 -Hok = False if LIBINT_ONEBODY_DERIV>1 and LIBINT_ERI_DERIV>1 else True - -for line in instr: - match1 = re.match('\*\* Hartree-Fock energy =' + pat_numbers(1), line) - match2 = re.match('\*\* edipole =' + pat_numbers(3), line) - match3 = re.match('\*\* equadrupole =' + pat_numbers(6), line) - match4 = re.match('\*\* 1-body forces =' + pat_numbers(9), line) - match5 = re.match('\*\* Pulay forces =' + pat_numbers(9), line) - match6 = re.match('\*\* 2-body forces =' + pat_numbers(9), line) - match7 = re.match('\*\* nuclear repulsion forces =' + pat_numbers(9), line) - match8 = re.match('\*\* Hartree-Fock forces =' + pat_numbers(9), line) - match9 = re.match('\*\* 1-body hessian =' + pat_numbers(45), line) - match10 = re.match('\*\* Pulay hessian =' + pat_numbers(45), line) - match11 = re.match('\*\* 2-body hessian =' + pat_numbers(45), line) - match12 = re.match('\*\* nuclear repulsion hessian =' + pat_numbers(45), line) - match13 = re.match('\*\* Hartree-Fock hessian =' + pat_numbers(45), line) - match14 = re.match('\*\* sph edipole =' + pat_numbers(3), line) - match15 = re.match('\*\* sph equadrupole =' + pat_numbers(5), line) - if match1: - eok = validate("HF energy", match1.groups(), eref, etol, line) - elif match2: - muok = validate("electric dipole moment", match2.groups(), muref, mutol, line) - elif match3: - Qok = validate("electric quadrupole moment", match3.groups(), Qref, Qtol, line) - elif match4: - F1ok = validate("1-body force", match4.groups(), F1ref, F1tol, line) - elif match5: - FPok = validate("Pulay force", match5.groups(), FPref, FPtol, line) - elif match6: - F2ok = validate("2-body force", match6.groups(), F2ref, F2tol, line) - elif match7: - FNok = validate("nuclear repulsion force", match7.groups(), FNref, FNtol, line) - elif match8: - Fok = validate("HF force", match8.groups(), Fref, Ftol, line) - elif match9: - H1ok = validate("1-body hessian", match9.groups(), H1ref, H1tol, line) - elif match10: - HPok = validate("Pulay hessian", match10.groups(), HPref, HPtol, line) - elif match11: - H2ok = validate("2-body hessian", match11.groups(), H2ref, H2tol, line) - elif match12: - HNok = validate("nuclear repulsion hessian", match12.groups(), HNref, HNtol, line) - elif match13: - Hok = validate("HF hessian", match13.groups(), Href, Htol, line) - elif match14: - smuok = validate("spherical electric dipole moment", match14.groups(), smuref, smutol, line) - elif match15: - sQok = validate("spherical electric quadrupole moment", match15.groups(), sQref, sQtol, line) - else: - print(line,end="") - -if len(sys.argv) > 2: - instr.close() -ok = eok and muok and Qok and F1ok and FPok and F2ok and FNok and Fok and H1ok and HPok and H2ok and HNok and Hok and smuok and sQok -if not ok: sys.exit(1) - - diff --git a/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc b/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc deleted file mode 100644 index 3f95c006e..000000000 --- a/src/lib/libint/tests/hartree-fock/hartree-fock-cpp.cc +++ /dev/null @@ -1,2538 +0,0 @@ -/* - * Copyright (C) 2004-2021 Edward F. Valeev - * - * This file is part of Libint. - * - * Libint is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Libint is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Libint. If not, see . - * - */ - -// standard C++ headers -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Eigen matrix algebra library -#include -#include -#include - -// have BTAS library? -#ifdef LIBINT2_HAVE_BTAS -#include -#endif // LIBINT2_HAVE_BTAS - -// Libint Gaussian integrals library -#include -#include -#include -#include -#include -#if !LIBINT2_CONSTEXPR_STATICS -# include -#endif - -#if defined(_OPENMP) -#include -#endif - -/// to use precomputed shell pair data must decide on max precision a priori -const auto max_engine_precision = std::numeric_limits::epsilon() / 1e10; - -// use conservative screening method -constexpr auto screening_method = libint2::ScreeningMethod::SchwarzInf; - -// uncomment if want to report integral timings -// N.B. integral engine timings are controled in engine.h -#define REPORT_INTEGRAL_TIMINGS - -typedef Eigen::Matrix - Matrix; // import dense, dynamically sized Matrix type from Eigen; - // this is a matrix with row-major storage - // (http://en.wikipedia.org/wiki/Row-major_order) -// to meet the layout of the integrals returned by the Libint integral library -typedef Eigen::DiagonalMatrix - DiagonalMatrix; - -using libint2::Shell; -using libint2::Atom; -using libint2::BasisSet; -using libint2::Operator; -using libint2::BraKet; -using libint2::ScreeningMethod; - -std::vector read_geometry(const std::string& filename); -Matrix compute_soad(const std::vector& atoms); -// computes norm of shell-blocks of A -Matrix compute_shellblock_norm(const BasisSet& obs, const Matrix& A); - -template ::oper_params_type> -std::array::nopers> compute_1body_ints( - const BasisSet& obs, - OperatorParams oparams = - OperatorParams()); - -#if LIBINT2_DERIV_ONEBODY_ORDER -template -std::vector compute_1body_ints_deriv(unsigned deriv_order, - const BasisSet& obs, - const std::vector& atoms); -#endif // LIBINT2_DERIV_ONEBODY_ORDER - -template -Matrix compute_schwarz_ints( - const BasisSet& bs1, const BasisSet& bs2 = BasisSet(), - bool use_2norm = false, // use infty norm by default - typename libint2::operator_traits::oper_params_type params = - libint2::operator_traits::default_params()); -Matrix compute_do_ints(const BasisSet& bs1, const BasisSet& bs2 = BasisSet(), - bool use_2norm = false // use infty norm by default - ); - -using shellpair_list_t = std::unordered_map>; -shellpair_list_t obs_shellpair_list; // shellpair list for OBS -using shellpair_data_t = std::vector>>; // in same order as shellpair_list_t -shellpair_data_t obs_shellpair_data; // shellpair data for OBS - -/// computes non-negligible shell pair list; shells \c i and \c j form a -/// non-negligible -/// pair if they share a center or the Frobenius norm of their overlap is -/// greater than threshold -std::tuple -compute_shellpairs(const BasisSet& bs1, - const BasisSet& bs2 = BasisSet(), - double threshold = 1e-12); - -Matrix compute_2body_fock( - const BasisSet& obs, const Matrix& D, - double precision = std::numeric_limits< - double>::epsilon(), // discard contributions smaller than this - const Matrix& Schwarz = Matrix() // K_ij = sqrt(||(ij|ij)||_\infty); if - // empty, do not Schwarz screen - ); -// an Fock builder that can accept densities expressed a separate basis -Matrix compute_2body_fock_general( - const BasisSet& obs, const Matrix& D, const BasisSet& D_bs, - bool D_is_sheldiagonal = false, // set D_is_shelldiagonal if doing SOAD - double precision = std::numeric_limits< - double>::epsilon() // discard contributions smaller than this - ); - -#if LIBINT2_DERIV_ERI_ORDER -template -std::vector compute_2body_fock_deriv( - const BasisSet& obs, const std::vector& atoms, - const Matrix& D, - double precision = std::numeric_limits< - double>::epsilon(), // discard contributions smaller than this - const Matrix& Schwarz = Matrix() // K_ij = sqrt(||(ij|ij)||_\infty); if - // empty, do not Schwarz screen - ); -#endif // LIBINT2_DERIV_ERI_ORDER - -// returns {X,X^{-1},S_condition_number_after_conditioning}, where -// X is the generalized square-root-inverse such that X.transpose() * S * X = I -// columns of Xinv is the basis conditioned such that -// the condition number of its metric (Xinv.transpose . Xinv) < -// S_condition_number_threshold -std::tuple conditioning_orthogonalizer( - const Matrix& S, double S_condition_number_threshold); - -#ifdef LIBINT2_HAVE_BTAS -#define HAVE_DENSITY_FITTING 1 -struct DFFockEngine { - const BasisSet& obs; - const BasisSet& dfbs; - DFFockEngine(const BasisSet& _obs, const BasisSet& _dfbs) - : obs(_obs), dfbs(_dfbs) {} - - typedef btas::RangeNd> Range3d; - typedef btas::Tensor Tensor3d; - Tensor3d xyK; - - // a DF-based builder, using coefficients of occupied MOs - Matrix compute_2body_fock_dfC(const Matrix& Cocc); -}; -#endif // HAVE_DENSITY_FITTING - -namespace libint2 { -int nthreads; - -/// fires off \c nthreads instances of lambda in parallel -template -void parallel_do(Lambda& lambda) { -#ifdef _OPENMP -#pragma omp parallel - { - auto thread_id = omp_get_thread_num(); - lambda(thread_id); - } -#else // use C++11 threads - std::vector threads; - for (int thread_id = 0; thread_id != libint2::nthreads; ++thread_id) { - if (thread_id != nthreads - 1) - threads.push_back(std::thread(lambda, thread_id)); - else - lambda(thread_id); - } // threads_id - for (int thread_id = 0; thread_id < nthreads - 1; ++thread_id) - threads[thread_id].join(); -#endif -} -} - -int main(int argc, char* argv[]) { - using std::cout; - using std::cerr; - using std::endl; - - try { - /*** =========================== ***/ - /*** initialize molecule ***/ - /*** =========================== ***/ - - // read geometry from a file; by default read from h2o.xyz, else take - // filename (.xyz) from the command line - const auto filename = (argc > 1) ? argv[1] : "h2o.xyz"; - const auto basisname = (argc > 2) ? argv[2] : "aug-cc-pVDZ"; - bool do_density_fitting = false; -#ifdef HAVE_DENSITY_FITTING - do_density_fitting = (argc > 3); - const auto dfbasisname = do_density_fitting ? argv[3] : ""; -#endif - std::vector atoms = read_geometry(filename); - - // set up thread pool - { - using libint2::nthreads; - auto nthreads_cstr = getenv("LIBINT_NUM_THREADS"); - nthreads = 1; - if (nthreads_cstr && strcmp(nthreads_cstr, "")) { - std::istringstream iss(nthreads_cstr); - iss >> nthreads; - if (nthreads > 1 << 16 || nthreads <= 0) nthreads = 1; - } -#if defined(_OPENMP) - omp_set_num_threads(nthreads); -#endif - std::cout << "Will scale over " << nthreads -#if defined(_OPENMP) - << " OpenMP" -#else - << " C++11" -#endif - << " threads" << std::endl; - } - - // count the number of electrons - auto nelectron = 0; - for (auto i = 0; i < atoms.size(); ++i) nelectron += atoms[i].atomic_number; - const auto ndocc = nelectron / 2; - cout << "# of electrons = " << nelectron << endl; - - // compute the nuclear repulsion energy - auto enuc = 0.0; - for (auto i = 0; i < atoms.size(); i++) - for (auto j = i + 1; j < atoms.size(); j++) { - auto xij = atoms[i].x - atoms[j].x; - auto yij = atoms[i].y - atoms[j].y; - auto zij = atoms[i].z - atoms[j].z; - auto r2 = xij * xij + yij * yij + zij * zij; - auto r = sqrt(r2); - enuc += atoms[i].atomic_number * atoms[j].atomic_number / r; - } - cout << "Nuclear repulsion energy = " << std::setprecision(15) << enuc - << endl; - - libint2::Shell::do_enforce_unit_normalization(false); - - cout << "Atomic Cartesian coordinates (a.u.):" << endl; - for (const auto& a : atoms) - std::cout << a.atomic_number << " " << a.x << " " << a.y << " " << a.z - << std::endl; - - BasisSet obs(basisname, atoms); - cout << "orbital basis set rank = " << obs.nbf() << endl; - -#ifdef HAVE_DENSITY_FITTING - BasisSet dfbs; - if (do_density_fitting) { - dfbs = BasisSet(dfbasisname, atoms); - cout << "density-fitting basis set rank = " << dfbs.nbf() << endl; - } -#endif // HAVE_DENSITY_FITTING - - /*** =========================== ***/ - /*** compute 1-e integrals ***/ - /*** =========================== ***/ - - // initializes the Libint integrals library ... now ready to compute - libint2::initialize(); - - // compute OBS non-negligible shell-pair list - { - const auto tstart = std::chrono::high_resolution_clock::now(); - std::tie(obs_shellpair_list, obs_shellpair_data) = compute_shellpairs(obs); - size_t nsp = 0; - for (auto& sp : obs_shellpair_list) { - nsp += sp.second.size(); - } - const auto tstop = std::chrono::high_resolution_clock::now(); - const std::chrono::duration time_elapsed = tstop - tstart; - std::cout << "computed shell-pair data in " << time_elapsed.count() << " seconds: # of {all,non-negligible} shell-pairs = {" - << obs.size() * (obs.size() + 1) / 2 << "," << nsp << "}" - << std::endl; - } - - // compute one-body integrals - auto S = compute_1body_ints(obs)[0]; - auto T = compute_1body_ints(obs)[0]; - auto V = compute_1body_ints(obs, libint2::make_point_charges(atoms))[0]; - Matrix H = T + V; - T.resize(0, 0); - V.resize(0, 0); - - // compute orthogonalizer X such that X.transpose() . S . X = I - Matrix X, Xinv; - double XtX_condition_number; // condition number of "re-conditioned" - // overlap obtained as Xinv.transpose() . Xinv - // one should think of columns of Xinv as the conditioned basis - // Re: name ... cond # (Xinv.transpose() . Xinv) = cond # (X.transpose() . - // X) - // by default assume can manage to compute with condition number of S <= - // 1/eps - // this is probably too optimistic, but in well-behaved cases even 10^11 is - // OK - double S_condition_number_threshold = - 1.0 / std::numeric_limits::epsilon(); - std::tie(X, Xinv, XtX_condition_number) = - conditioning_orthogonalizer(S, S_condition_number_threshold); - - Matrix D; - Matrix C; - Matrix C_occ; - Matrix evals; - { // use SOAD as the guess density - const auto tstart = std::chrono::high_resolution_clock::now(); - - auto D_minbs = compute_soad(atoms); // compute guess in minimal basis - BasisSet minbs("STO-3G", atoms); - if (minbs == obs) - D = D_minbs; - else { // if basis != minimal basis, map non-representable SOAD guess - // into the AO basis - // by diagonalizing a Fock matrix - std::cout << "projecting SOAD into AO basis ... "; - auto F = H; - F += compute_2body_fock_general( - obs, D_minbs, minbs, true /* SOAD_D_is_shelldiagonal */, - std::numeric_limits::epsilon() // this is cheap, no reason - // to be cheaper - ); - - // solve F C = e S C by (conditioned) transformation to F' C' = e C', - // where - // F' = X.transpose() . F . X; the original C is obtained as C = X . C' - Eigen::SelfAdjointEigenSolver eig_solver(X.transpose() * F * X); - C = X * eig_solver.eigenvectors(); - - // compute density, D = C(occ) . C(occ)T - C_occ = C.leftCols(ndocc); - D = C_occ * C_occ.transpose(); - - const auto tstop = std::chrono::high_resolution_clock::now(); - const std::chrono::duration time_elapsed = tstop - tstart; - std::cout << "done (" << time_elapsed.count() << " s)" << std::endl; - } - } - - // pre-compute data for Schwarz bounds - auto K = compute_schwarz_ints<>(obs); - -// prepare for density fitting -#ifdef HAVE_DENSITY_FITTING - std::unique_ptr dffockengine( - do_density_fitting ? new DFFockEngine(obs, dfbs) : nullptr); -#endif // HAVE_DENSITY_FITTING - - /*** =========================== ***/ - /*** SCF loop ***/ - /*** =========================== ***/ - - const auto maxiter = 100; - const auto conv = 1e-12; - auto iter = 0; - auto rms_error = 1.0; - auto ediff_rel = 0.0; - auto ehf = 0.0; - auto n2 = D.cols() * D.rows(); - libint2::DIIS diis(2); // start DIIS on second iteration - - // prepare for incremental Fock build ... - Matrix D_diff = D; - Matrix F = H; - bool reset_incremental_fock_formation = false; - bool incremental_Fbuild_started = false; - double start_incremental_F_threshold = 1e-5; - double next_reset_threshold = 0.0; - size_t last_reset_iteration = 0; - // ... unless doing DF, then use MO coefficients, hence not "incremental" - if (do_density_fitting) start_incremental_F_threshold = 0.0; - - do { - const auto tstart = std::chrono::high_resolution_clock::now(); - ++iter; - - // Last iteration's energy and density - auto ehf_last = ehf; - Matrix D_last = D; - - if (not incremental_Fbuild_started && - rms_error < start_incremental_F_threshold) { - incremental_Fbuild_started = true; - reset_incremental_fock_formation = false; - last_reset_iteration = iter - 1; - next_reset_threshold = rms_error / 1e1; - std::cout << "== started incremental fock build" << std::endl; - } - if (reset_incremental_fock_formation || not incremental_Fbuild_started) { - F = H; - D_diff = D; - } - if (reset_incremental_fock_formation && incremental_Fbuild_started) { - reset_incremental_fock_formation = false; - last_reset_iteration = iter; - next_reset_threshold = rms_error / 1e1; - std::cout << "== reset incremental fock build" << std::endl; - } - - // build a new Fock matrix - if (not do_density_fitting) { - // totally empirical precision variation, involves the condition number - const auto precision_F = std::min( - std::min(1e-3 / XtX_condition_number, 1e-7), - std::max(rms_error / 1e4, std::numeric_limits::epsilon())); - F += compute_2body_fock(obs, D_diff, precision_F, K); - } -#if HAVE_DENSITY_FITTING - else { // do DF - F = H + dffockengine->compute_2body_fock_dfC(C_occ); - } -#else - else { - assert(false); - } // do_density_fitting is true but HAVE_DENSITY_FITTING is not defined! - // should not happen -#endif // HAVE_DENSITY_FITTING - - // compute HF energy with the non-extrapolated Fock matrix - ehf = D.cwiseProduct(H + F).sum(); - ediff_rel = std::abs((ehf - ehf_last) / ehf); - - // compute SCF error - Matrix FD_comm = F * D * S - S * D * F; - rms_error = FD_comm.norm() / n2; - if (rms_error < next_reset_threshold || iter - last_reset_iteration >= 8) - reset_incremental_fock_formation = true; - - // DIIS extrapolate F - Matrix F_diis = F; // extrapolated F cannot be used in incremental Fock - // build; only used to produce the density - // make a copy of the unextrapolated matrix - diis.extrapolate(F_diis, FD_comm); - - // solve F C = e S C by (conditioned) transformation to F' C' = e C', - // where - // F' = X.transpose() . F . X; the original C is obtained as C = X . C' - Eigen::SelfAdjointEigenSolver eig_solver(X.transpose() * F_diis * - X); - evals = eig_solver.eigenvalues(); - C = X * eig_solver.eigenvectors(); - - // compute density, D = C(occ) . C(occ)T - C_occ = C.leftCols(ndocc); - D = C_occ * C_occ.transpose(); - D_diff = D - D_last; - - const auto tstop = std::chrono::high_resolution_clock::now(); - const std::chrono::duration time_elapsed = tstop - tstart; - - if (iter == 1) - std::cout << "\n\nIter E(HF) D(E)/E " - "RMS([F,D])/nn Time(s)\n"; - printf(" %02d %20.12f %20.12e %20.12e %10.5lf\n", iter, ehf + enuc, - ediff_rel, rms_error, time_elapsed.count()); - - } while (((ediff_rel > conv) || (rms_error > conv)) && (iter < maxiter)); - - printf("** Hartree-Fock energy = %20.12f\n", ehf + enuc); - - // dump orbs to a molden file - { - Eigen::VectorXd occs(C.cols()); - occs.setZero(); - for(size_t o=0; o!=ndocc; ++o) - occs[o] = 2.0; - - libint2::molden::Export xport(atoms, obs, C, occs, evals); - std::ofstream molden_file("hf++.molden"); - xport.write(molden_file); - } - - auto Mu = compute_1body_ints(obs); - - std::array mu; - for (int xyz = 0; xyz != 3; ++xyz) - mu[xyz] = -2 * - D.cwiseProduct(Mu[xyz + 1]) - .sum(); // 2 = alpha + beta, -1 = electron charge - std::cout << "** edipole = "; - std::copy(mu.begin(), mu.end(), - std::ostream_iterator(std::cout, " ")); - std::cout << std::endl; - - std::array qu; - for (int k = 0; k != 6; ++k) - qu[k] = -2 * - D.cwiseProduct(Mu[k + 4]) - .sum(); // 2 = alpha + beta, -1 = electron charge - std::cout << "** equadrupole = "; - std::copy(qu.begin(), qu.end(), - std::ostream_iterator(std::cout, " ")); - std::cout << std::endl; - - std::array oct; - for (int k = 0; k != 10; ++k) - oct[k] = -2 * - D.cwiseProduct(Mu[k + 10]) - .sum(); // 2 = alpha + beta, -1 = electron charge -// std::cout << "** eoctupole = "; -// std::copy(oct.begin(), oct.end(), -// std::ostream_iterator(std::cout, " ")); -// std::cout << std::endl; - - // use spherical moments - auto SMu = compute_1body_ints(obs); - { -#if MULTIPOLE_MAX_ORDER > 0 - std::array mu; - for (int xyz = 0; xyz != 3; ++xyz) - mu[xyz] = -2 * - D.cwiseProduct(SMu[xyz + 1]) - .sum(); // 2 = alpha + beta, -1 = electron charge - std::cout << "** sph edipole = "; - std::copy(mu.begin(), mu.end(), - std::ostream_iterator(std::cout, " ")); - std::cout << std::endl; -#endif -#if MULTIPOLE_MAX_ORDER > 1 - std::array qu; - for (int k = 0; k != 5; ++k) - qu[k] = -2 * - D.cwiseProduct(SMu[k + 4]) - .sum(); // 2 = alpha + beta, -1 = electron charge - std::cout << "** sph equadrupole = "; - std::copy(qu.begin(), qu.end(), - std::ostream_iterator(std::cout, " ")); - std::cout << std::endl; -#endif -#if MULTIPOLE_MAX_ORDER > 2 - std::array oct; - for (int k = 0; k != 7; ++k) - oct[k] = -2 * - D.cwiseProduct(SMu[k + 9]) - .sum(); // 2 = alpha + beta, -1 = electron charge -// std::cout << "** sph eoctupole = "; -// std::copy(oct.begin(), oct.end(), -// std::ostream_iterator(std::cout, " ")); -// std::cout << std::endl; - - // recompute C^3_0 from xxz, yyz, and zzz - std::cout << "C^3_0 - (2zzz - 3xxz - 3yyz)/12:\n" << ((2.*Mu[19] - 3.*Mu[12] - 3.*Mu[17])/12 - SMu[12]).norm() << std::endl; -#endif - } - - { // compute force -#if LIBINT2_DERIV_ONEBODY_ORDER - // compute 1-e forces - Matrix F1 = Matrix::Zero(atoms.size(), 3); - Matrix F_Pulay = Matrix::Zero(atoms.size(), 3); - ////////// - // one-body contributions to the forces - ////////// - auto T1 = compute_1body_ints_deriv(1, obs, atoms); - auto V1 = compute_1body_ints_deriv(1, obs, atoms); - for (auto atom = 0, i = 0; atom != atoms.size(); ++atom) { - for (auto xyz = 0; xyz != 3; ++xyz, ++i) { - auto force = 2 * (T1[i] + V1[i]).cwiseProduct(D).sum(); - F1(atom, xyz) += force; - } - } - - ////////// - // Pulay force - ////////// - // orbital energy density - DiagonalMatrix evals_occ(evals.topRows(ndocc)); - Matrix W = C_occ * evals_occ * C_occ.transpose(); - auto S1 = compute_1body_ints_deriv(1, obs, atoms); - for (auto atom = 0, i = 0; atom != atoms.size(); ++atom) { - for (auto xyz = 0; xyz != 3; ++xyz, ++i) { - auto force = 2 * S1[i].cwiseProduct(W).sum(); - F_Pulay(atom, xyz) -= force; - } - } - - std::cout << "** 1-body forces = "; - for (int atom = 0; atom != atoms.size(); ++atom) - for (int xyz = 0; xyz != 3; ++xyz) std::cout << F1(atom, xyz) << " "; - std::cout << std::endl; - std::cout << "** Pulay forces = "; - for (int atom = 0; atom != atoms.size(); ++atom) - for (int xyz = 0; xyz != 3; ++xyz) - std::cout << F_Pulay(atom, xyz) << " "; - std::cout << std::endl; -#endif // LIBINT2_DERIV_ONEBODY_ORDER - -#if LIBINT2_DERIV_ERI_ORDER - // compute 2-e forces - Matrix F2 = Matrix::Zero(atoms.size(), 3); - - ////////// - // two-body contributions to the forces - ////////// - auto G1 = compute_2body_fock_deriv<1>(obs, atoms, D); - for (auto atom = 0, i = 0; atom != atoms.size(); ++atom) { - for (auto xyz = 0; xyz != 3; ++xyz, ++i) { - // identity prefactor since E(HF) = trace(H + F, D) = trace(2H + G, D) - auto force = G1[i].cwiseProduct(D).sum(); - F2(atom, xyz) += force; - } - } - - std::cout << "** 2-body forces = "; - for (int atom = 0; atom != atoms.size(); ++atom) - for (int xyz = 0; xyz != 3; ++xyz) std::cout << F2(atom, xyz) << " "; - std::cout << std::endl; -#endif - -// if support 1-e and 2-e derivatives compute nuclear repulsion force and the -// total force -#if LIBINT2_DERIV_ONEBODY_ORDER && LIBINT2_DERIV_ERI_ORDER - // compute nuclear repulsion forces - Matrix FN = Matrix::Zero(atoms.size(), 3); - ////////// - // nuclear repulsion contribution to the forces - ////////// - for (auto a1 = 1; a1 != atoms.size(); ++a1) { - const auto& atom1 = atoms[a1]; - for (auto a2 = 0; a2 < a1; ++a2) { - const auto& atom2 = atoms[a2]; - - auto x12 = atom1.x - atom2.x; - auto y12 = atom1.y - atom2.y; - auto z12 = atom1.z - atom2.z; - auto r12_2 = x12 * x12 + y12 * y12 + z12 * z12; - auto r12 = sqrt(r12_2); - auto r12_3 = r12 * r12_2; - - auto z1z2_over_r12_3 = - atom1.atomic_number * atom2.atomic_number / r12_3; - - auto fx = -x12 * z1z2_over_r12_3; - auto fy = -y12 * z1z2_over_r12_3; - auto fz = -z12 * z1z2_over_r12_3; - FN(a1, 0) += fx; - FN(a1, 1) += fy; - FN(a1, 2) += fz; - FN(a2, 0) -= fx; - FN(a2, 1) -= fy; - FN(a2, 2) -= fz; - } - } - - std::cout << "** nuclear repulsion forces = "; - for (int atom = 0; atom != atoms.size(); ++atom) - for (int xyz = 0; xyz != 3; ++xyz) std::cout << FN(atom, xyz) << " "; - std::cout << std::endl; - - auto F = F1 + F_Pulay + F2 + FN; - std::cout << "** Hartree-Fock forces = "; - for (int atom = 0; atom != atoms.size(); ++atom) - for (int xyz = 0; xyz != 3; ++xyz) std::cout << F(atom, xyz) << " "; - std::cout << std::endl; -#endif - } - - { // compute hessian - const auto ncoords = 3 * atoms.size(); - // # of elems in upper triangle - const auto nelem = ncoords * (ncoords+1) / 2; -#if LIBINT2_DERIV_ONEBODY_ORDER > 1 - // compute 1-e hessian - Matrix H1 = Matrix::Zero(ncoords, ncoords); - Matrix H_Pulay = Matrix::Zero(ncoords, ncoords); - ////////// - // one-body contributions to the hessian - ////////// - auto T2 = compute_1body_ints_deriv(2, obs, atoms); - auto V2 = compute_1body_ints_deriv(2, obs, atoms); - for (auto row = 0, i = 0; row != ncoords; ++row) { - for (auto col = row; col != ncoords; ++col, ++i) { - auto hess = 2 * (T2[i] + V2[i]).cwiseProduct(D).sum(); - H1(row, col) += hess; - } - } - - ////////// - // Pulay hessian - ////////// - // orbital energy density - DiagonalMatrix evals_occ(evals.topRows(ndocc)); - Matrix W = C_occ * evals_occ * C_occ.transpose(); - auto S2 = compute_1body_ints_deriv(2, obs, atoms); - for (auto row = 0, i = 0; row != ncoords; ++row) { - for (auto col = row; col != ncoords; ++col, ++i) { - auto hess = 2 * S2[i].cwiseProduct(W).sum(); - H_Pulay(row, col) -= hess; - } - } - - std::cout << "** 1-body hessian = "; - for (auto row = 0, i = 0; row != ncoords; ++row) { - for (auto col = row; col != ncoords; ++col) { - std::cout << H1(row, col) << " "; - } - } - std::cout << std::endl; - - std::cout << "** Pulay hessian = "; - for (auto row = 0, i = 0; row != ncoords; ++row) { - for (auto col = row; col != ncoords; ++col) { - std::cout << H_Pulay(row, col) << " "; - } - } - std::cout << std::endl; -#endif // LIBINT2_DERIV_ONEBODY_ORDER > 1 - -#if LIBINT2_DERIV_ERI_ORDER > 1 - // compute 2-e forces - Matrix H2 = Matrix::Zero(ncoords, ncoords); - - ////////// - // two-body contributions to the forces - ////////// - auto G2 = compute_2body_fock_deriv<2>(obs, atoms, D); - for (auto row = 0, i = 0; row != ncoords; ++row) { - for (auto col = row; col != ncoords; ++col, ++i) { - // identity prefactor since E(HF) = trace(H + F, D) = trace(2H + G, D) - auto hess = G2[i].cwiseProduct(D).sum(); - H2(row, col) += hess; - } - } - - std::cout << "** 2-body hessian = "; - for (auto row = 0, i = 0; row != ncoords; ++row) { - for (auto col = row; col != ncoords; ++col) { - std::cout << H2(row, col) << " "; - } - } - std::cout << std::endl; -#endif - -// if support 1-e and 2-e 2nd derivatives compute nuclear repulsion hessian and -// the total hessian -#if LIBINT2_DERIV_ONEBODY_ORDER > 1 && LIBINT2_DERIV_ERI_ORDER > 1 - // compute nuclear repulsion hessian - // NB only the upper triangle is computed!!! - Matrix HN = Matrix::Zero(ncoords, ncoords); - - ////////// - // nuclear repulsion contribution to the hessian - ////////// - for (auto a1 = 1; a1 != atoms.size(); ++a1) { - const auto& atom1 = atoms[a1]; - for (auto a2 = 0; a2 < a1; ++a2) { - const auto& atom2 = atoms[a2]; - - auto x12 = atom1.x - atom2.x; - auto y12 = atom1.y - atom2.y; - auto z12 = atom1.z - atom2.z; - auto x12_2 = x12 * x12; - auto y12_2 = y12 * y12; - auto z12_2 = z12 * z12; - auto r12_2 = x12 * x12 + y12 * y12 + z12 * z12; - auto r12 = sqrt(r12_2); - auto r12_5 = r12 * r12_2 * r12_2; - - auto z1z2_over_r12_5 = - atom1.atomic_number * atom2.atomic_number / r12_5; - - HN(3*a1 + 0, 3*a1 + 0) += z1z2_over_r12_5 * (3*x12_2 - r12_2); - HN(3*a1 + 1, 3*a1 + 1) += z1z2_over_r12_5 * (3*y12_2 - r12_2); - HN(3*a1 + 2, 3*a1 + 2) += z1z2_over_r12_5 * (3*z12_2 - r12_2); - HN(3*a1 + 0, 3*a1 + 1) += z1z2_over_r12_5 * (3*x12*y12); - HN(3*a1 + 0, 3*a1 + 2) += z1z2_over_r12_5 * (3*x12*z12); - HN(3*a1 + 1, 3*a1 + 2) += z1z2_over_r12_5 * (3*y12*z12); - - HN(3*a2 + 0, 3*a2 + 0) += z1z2_over_r12_5 * (3*x12_2 - r12_2); - HN(3*a2 + 1, 3*a2 + 1) += z1z2_over_r12_5 * (3*y12_2 - r12_2); - HN(3*a2 + 2, 3*a2 + 2) += z1z2_over_r12_5 * (3*z12_2 - r12_2); - HN(3*a2 + 0, 3*a2 + 1) += z1z2_over_r12_5 * (3*x12*y12); - HN(3*a2 + 0, 3*a2 + 2) += z1z2_over_r12_5 * (3*x12*z12); - HN(3*a2 + 1, 3*a2 + 2) += z1z2_over_r12_5 * (3*y12*z12); - - HN(3*a2 + 0, 3*a1 + 0) -= z1z2_over_r12_5 * (3*x12_2 - r12_2); - HN(3*a2 + 1, 3*a1 + 1) -= z1z2_over_r12_5 * (3*y12_2 - r12_2); - HN(3*a2 + 2, 3*a1 + 2) -= z1z2_over_r12_5 * (3*z12_2 - r12_2); - HN(3*a2 + 1, 3*a1 + 0) -= z1z2_over_r12_5 * (3*y12*x12); - HN(3*a2 + 2, 3*a1 + 0) -= z1z2_over_r12_5 * (3*z12*x12); - HN(3*a2 + 2, 3*a1 + 1) -= z1z2_over_r12_5 * (3*z12*y12); - HN(3*a2 + 0, 3*a1 + 1) -= z1z2_over_r12_5 * (3*x12*y12); - HN(3*a2 + 0, 3*a1 + 2) -= z1z2_over_r12_5 * (3*x12*z12); - HN(3*a2 + 1, 3*a1 + 2) -= z1z2_over_r12_5 * (3*y12*z12); - } - } - - std::cout << "** nuclear repulsion hessian = "; - for (auto row = 0, i = 0; row != ncoords; ++row) { - for (auto col = row; col != ncoords; ++col) { - std::cout << HN(row, col) << " "; - } - } - std::cout << std::endl; - - auto H = H1 + H_Pulay + H2 + HN; - std::cout << "** Hartree-Fock hessian = "; - for (auto row = 0, i = 0; row != ncoords; ++row) { - for (auto col = row; col != ncoords; ++col) { - std::cout << H(row, col) << " "; - } - } - std::cout << std::endl; -#endif - } - - libint2::finalize(); // done with libint - - } // end of try block; if any exceptions occurred, report them and exit - // cleanly - - catch (const char* ex) { - cerr << "caught exception: " << ex << endl; - return 1; - } catch (std::string& ex) { - cerr << "caught exception: " << ex << endl; - return 1; - } catch (std::exception& ex) { - cerr << ex.what() << endl; - return 1; - } catch (...) { - cerr << "caught unknown exception\n"; - return 1; - } - - return 0; -} - -std::vector read_geometry(const std::string& filename) { - std::cout << "Will read geometry from " << filename << std::endl; - std::ifstream is(filename); - if (not is.good()) { - char errmsg[256] = "Could not open file "; - strncpy(errmsg + 20, filename.c_str(), 235); - errmsg[255] = '\0'; - throw std::runtime_error(errmsg); - } - - // to prepare for MPI parallelization, we will read the entire file into a - // string that can be - // broadcast to everyone, then converted to an std::istringstream object that - // can be used just like std::ifstream - std::ostringstream oss; - oss << is.rdbuf(); - // use ss.str() to get the entire contents of the file as an std::string - // broadcast - // then make an std::istringstream in each process - std::istringstream iss(oss.str()); - - // check the extension: if .xyz, assume the standard XYZ format, otherwise - // throw an exception - if (filename.rfind(".xyz") != std::string::npos) - return libint2::read_dotxyz(iss); - else - throw "only .xyz files are accepted"; -} - -// computes Superposition-Of-Atomic-Densities guess for the molecular density -// matrix -// in minimal basis; occupies subshells by smearing electrons evenly over the -// orbitals -Matrix compute_soad(const std::vector& atoms) { - // compute number of atomic orbitals - size_t nao = 0; - for (const auto& atom : atoms) { - const auto Z = atom.atomic_number; - nao += libint2::sto3g_num_ao(Z); - } - - // compute the minimal basis density - Matrix D = Matrix::Zero(nao, nao); - size_t ao_offset = 0; // first AO of this atom - for (const auto& atom : atoms) { - const auto Z = atom.atomic_number; - const auto& occvec = libint2::sto3g_ao_occupation_vector(Z); - for(const auto& occ: occvec) { - D(ao_offset, ao_offset) = occ; - ++ao_offset; - } - } - - return D * 0.5; // we use densities normalized to # of electrons/2 -} - -Matrix compute_shellblock_norm(const BasisSet& obs, const Matrix& A) { - const auto nsh = obs.size(); - Matrix Ash(nsh, nsh); - - auto shell2bf = obs.shell2bf(); - for (size_t s1 = 0; s1 != nsh; ++s1) { - const auto& s1_first = shell2bf[s1]; - const auto& s1_size = obs[s1].size(); - for (size_t s2 = 0; s2 != nsh; ++s2) { - const auto& s2_first = shell2bf[s2]; - const auto& s2_size = obs[s2].size(); - - Ash(s1, s2) = A.block(s1_first, s2_first, s1_size, s2_size) - .lpNorm(); - } - } - - return Ash; -} - -template -std::array::nopers> compute_1body_ints( - const BasisSet& obs, OperatorParams oparams) { - const auto n = obs.nbf(); - const auto nshells = obs.size(); - using libint2::nthreads; - typedef std::array::nopers> - result_type; - const unsigned int nopers = libint2::operator_traits::nopers; - result_type result; - for (auto& r : result) r = Matrix::Zero(n, n); - - // construct the 1-body integrals engine - std::vector engines(nthreads); - engines[0] = libint2::Engine(obtype, obs.max_nprim(), obs.max_l(), 0); - // pass operator params to the engine, e.g. - // nuclear attraction ints engine needs to know where the charges sit ... - // the nuclei are charges in this case; in QM/MM there will also be classical - // charges - engines[0].set_params(oparams); - for (size_t i = 1; i != nthreads; ++i) { - engines[i] = engines[0]; - } - - auto shell2bf = obs.shell2bf(); - - auto compute = [&](int thread_id) { - - const auto& buf = engines[thread_id].results(); - - // loop over unique shell pairs, {s1,s2} such that s1 >= s2 - // this is due to the permutational symmetry of the real integrals over - // Hermitian operators: (1|2) = (2|1) - for (auto s1 = 0l, s12 = 0l; s1 != nshells; ++s1) { - auto bf1 = shell2bf[s1]; // first basis function in this shell - auto n1 = obs[s1].size(); - - auto s1_offset = s1 * (s1+1) / 2; - for (auto s2: obs_shellpair_list[s1]) { - auto s12 = s1_offset + s2; - if (s12 % nthreads != thread_id) continue; - - auto bf2 = shell2bf[s2]; - auto n2 = obs[s2].size(); - - auto n12 = n1 * n2; - - // compute shell pair; return is the pointer to the buffer - engines[thread_id].compute(obs[s1], obs[s2]); - - for (unsigned int op = 0; op != nopers; ++op) { - // "map" buffer to a const Eigen Matrix, and copy it to the - // corresponding blocks of the result - Eigen::Map buf_mat(buf[op], n1, n2); - result[op].block(bf1, bf2, n1, n2) = buf_mat; - if (s1 != s2) // if s1 >= s2, copy {s1,s2} to the corresponding - // {s2,s1} block, note the transpose! - result[op].block(bf2, bf1, n2, n1) = buf_mat.transpose(); - } - } - } - }; // compute lambda - - libint2::parallel_do(compute); - - return result; -} - -#if LIBINT2_DERIV_ONEBODY_ORDER -template -std::vector compute_1body_ints_deriv(unsigned deriv_order, - const BasisSet& obs, - const std::vector& atoms) { - using libint2::nthreads; - const auto n = obs.nbf(); - const auto nshells = obs.size(); - constexpr auto nopers = libint2::operator_traits::nopers; - const auto nresults = - nopers * libint2::num_geometrical_derivatives(atoms.size(), deriv_order); - typedef std::vector result_type; - result_type result(nresults); - for (auto& r : result) r = Matrix::Zero(n, n); - - // construct the 1-body integrals engine - std::vector engines(nthreads); - engines[0] = - libint2::Engine(obtype, obs.max_nprim(), obs.max_l(), deriv_order); - // nuclear attraction ints engine needs to know where the charges sit ... - // the nuclei are charges in this case; in QM/MM there will also be classical - // charges - if (obtype == Operator::nuclear) { - std::vector>> q; - for (const auto& atom : atoms) { - q.push_back({static_cast(atom.atomic_number), - {{atom.x, atom.y, atom.z}}}); - } - engines[0].set_params(q); - } - for (size_t i = 1; i != nthreads; ++i) { - engines[i] = engines[0]; - } - - auto shell2bf = obs.shell2bf(); - auto shell2atom = obs.shell2atom(atoms); - - const auto natoms = atoms.size(); - const auto two_times_ncoords = 6*natoms; - const auto nderivcenters_shset = - 2 + ((obtype == Operator::nuclear) ? natoms : 0); - - auto compute = [&](int thread_id) { - - const auto& buf = engines[thread_id].results(); - - // loop over unique shell pairs, {s1,s2} such that s1 >= s2 - // this is due to the permutational symmetry of the real integrals over - // Hermitian operators: (1|2) = (2|1) - for (auto s1 = 0l, s12 = 0l; s1 != nshells; ++s1) { - auto bf1 = shell2bf[s1]; // first basis function in this shell - auto n1 = obs[s1].size(); - auto atom1 = shell2atom[s1]; - assert(atom1 != -1); - - auto s1_offset = s1 * (s1+1) / 2; - for (auto s2: obs_shellpair_list[s1]) { - auto s12 = s1_offset + s2; - if (s12 % nthreads != thread_id) continue; - - auto bf2 = shell2bf[s2]; - auto n2 = obs[s2].size(); - auto atom2 = shell2atom[s2]; - - auto n12 = n1 * n2; - - // compute shell pair; return is the pointer to the buffer - engines[thread_id].compute(obs[s1], obs[s2]); - - // "copy" lambda copies shell set \c idx to the operator matrix with - // index \c op - auto add_shellset_to_dest = [&](std::size_t op, std::size_t idx, - double scale = 1.0) { - // "map" buffer to a const Eigen Matrix, and copy it to the - // corresponding blocks of the result - Eigen::Map buf_mat(buf[idx], n1, n2); - if (scale == 1.0) - result[op].block(bf1, bf2, n1, n2) += buf_mat; - else - result[op].block(bf1, bf2, n1, n2) += scale * buf_mat; - if (s1 != s2) { // if s1 >= s2, copy {s1,s2} to the corresponding - // {s2,s1} block, note the transpose! - if (scale == 1.0) - result[op].block(bf2, bf1, n2, n1) += buf_mat.transpose(); - else - result[op].block(bf2, bf1, n2, n1) += scale * buf_mat.transpose(); - } - }; - - switch (deriv_order) { - case 0: - for (std::size_t op = 0; op != nopers; ++op) { - add_shellset_to_dest(op, op); - } - break; - - // map deriv quanta for this shell pair to the overall deriv quanta - // - // easiest to explain with example: - // in sto-3g water shells 0 1 2 sit on atom 0, shells 3 and 4 on atoms - // 1 and 2 respectively - // each call to engine::compute for nuclear ints will return - // derivatives - // with respect to 15 coordinates, obtained as 3 (x,y,z) times 2 + 3 = - // 5 centers - // (2 centers on which shells sit + 3 nuclear charges) - // (for overlap, kinetic, and emultipole ints we there are only 6 - // coordinates - // since the operator is coordinate-independent, or derivatives with - // respect to - // the operator coordinates are not computed) - // - - case 1: { - std::size_t shellset_idx = 0; - for (auto c = 0; c != nderivcenters_shset; ++c) { - auto atom = (c == 0) ? atom1 : ((c == 1) ? atom2 : c - 2); - auto op_start = 3 * atom * nopers; - auto op_fence = op_start + nopers; - for (auto xyz = 0; xyz != 3; - ++xyz, op_start += nopers, op_fence += nopers) { - for (unsigned int op = op_start; op != op_fence; - ++op, ++shellset_idx) { - add_shellset_to_dest(op, shellset_idx); - } - } - } - } break; - - case 2: { - // - // must pay attention to symmetry when computing 2nd and higher-order derivs - // e.g. d2 (s1|s2) / dX dY involves several cases: - // 1. only s1 (or only s2) depends on X AND Y (i.e. X and Y refer to same atom) => - // d2 (s1|s2) / dX dY = (d2 s1 / dX dY | s2) - // 2. s1 depends on X only, s2 depends on Y only (or vice versa) => - // d2 (s1|s2) / dX dY = (d s1 / dX | d s2 / dY) - // 3. s1 AND s2 depend on X AND Y (i.e. X and Y refer to same atom) => - // case A: X != Y - // d2 (s1|s2) / dX dY = (d2 s1 / dX dY | s2) + (d s1 / dX | d s2 / dY) - // + (d s1 / dY | d s2 / dX) + (s1| d2 s2 / dX dY ) - // case B: X == Y - // d2 (s1|s2) / dX2 = (d2 s1 / dX2 | s2) + 2 (d s1 / dX | d s2 / dX) - // + (s1| d2 s2 / dX2 ) - - // computes upper triangle index - // n2 = matrix size times 2 - // i,j = (unordered) indices - auto upper_triangle_index = [](long n2, long i, long j) { - return std::min(i, j) * (n2 - std::min(i, j) - 1) / 2 + std::max(i, j); - }; - - // look over shellsets in the order in which they appear - std::size_t shellset_idx = 0; - for (auto c1 = 0; c1 != nderivcenters_shset; ++c1) { - auto a1 = (c1 == 0) ? atom1 : ((c1 == 1) ? atom2 : c1 - 2); - auto coord1 = 3 * a1; - for (auto xyz1 = 0; xyz1 != 3; ++xyz1, ++coord1) { - - for (auto c2 = c1; c2 != nderivcenters_shset; ++c2) { - auto a2 = (c2 == 0) ? atom1 : ((c2 == 1) ? atom2 : c2 - 2); - auto xyz2_start = (c1 == c2) ? xyz1 : 0; - auto coord2 = 3 * a2 + xyz2_start; - for (auto xyz2 = xyz2_start; xyz2 != 3; - ++xyz2, ++coord2) { - - double scale = (coord1 == coord2 && c1 != c2) ? 2.0 : 1.0; - - const auto coord12 = - upper_triangle_index(two_times_ncoords, coord1, coord2); - auto op_start = coord12 * nopers; - auto op_fence = op_start + nopers; - for (auto op = op_start; op != op_fence; - ++op, ++shellset_idx) { - add_shellset_to_dest(op, shellset_idx, scale); - } - } - } - } - } - } break; - - default: { - assert(false && "not yet implemented"); - - using ShellSetDerivIterator = - libint2::FixedOrderedIntegerPartitionIterator< - std::vector>; - ShellSetDerivIterator shellset_diter(deriv_order, - nderivcenters_shset); - while (shellset_diter) { - const auto& deriv = *shellset_diter; - } - } - } // copy shell block switch - - } // s2 <= s1 - } // s1 - }; // compute lambda - - libint2::parallel_do(compute); - - return result; -} -#endif - -template -Matrix compute_schwarz_ints( - const BasisSet& bs1, const BasisSet& _bs2, bool use_2norm, - typename libint2::operator_traits::oper_params_type params) { - const BasisSet& bs2 = (_bs2.empty() ? bs1 : _bs2); - const auto nsh1 = bs1.size(); - const auto nsh2 = bs2.size(); - const auto bs1_equiv_bs2 = (&bs1 == &bs2); - - Matrix K = Matrix::Zero(nsh1, nsh2); - - // construct the 2-electron repulsion integrals engine - using libint2::Engine; - using libint2::nthreads; - std::vector engines(nthreads); - - // !!! very important: cannot screen primitives in Schwarz computation !!! - auto epsilon = 0.; - engines[0] = Engine(Kernel, std::max(bs1.max_nprim(), bs2.max_nprim()), - std::max(bs1.max_l(), bs2.max_l()), 0, epsilon, params); - for (size_t i = 1; i != nthreads; ++i) { - engines[i] = engines[0]; - } - - std::cout << "computing Schwarz bound prerequisites (kernel=" << (int)Kernel - << ") ... "; - - libint2::Timers<1> timer; - timer.set_now_overhead(25); - timer.start(0); - - auto compute = [&](int thread_id) { - - const auto& buf = engines[thread_id].results(); - - // loop over permutationally-unique set of shells - for (auto s1 = 0l, s12 = 0l; s1 != nsh1; ++s1) { - auto n1 = bs1[s1].size(); // number of basis functions in this shell - - auto s2_max = bs1_equiv_bs2 ? s1 : nsh2 - 1; - for (auto s2 = 0; s2 <= s2_max; ++s2, ++s12) { - if (s12 % nthreads != thread_id) continue; - - auto n2 = bs2[s2].size(); - auto n12 = n1 * n2; - - engines[thread_id].compute2(bs1[s1], bs2[s2], - bs1[s1], bs2[s2]); - assert(buf[0] != nullptr && - "to compute Schwarz ints turn off primitive screening"); - - // to apply Schwarz inequality to individual integrals must use the "diagonal" elements - // to apply it to sets of functions (e.g. shells) use the whole shell-set of ints here - Eigen::Map buf_mat(buf[0], n12, n12); - auto norm2 = use_2norm ? buf_mat.norm() - : buf_mat.lpNorm(); - K(s1, s2) = std::sqrt(norm2); - if (bs1_equiv_bs2) K(s2, s1) = K(s1, s2); - } - } - }; // thread lambda - - libint2::parallel_do(compute); - - timer.stop(0); - std::cout << "done (" << timer.read(0) << " s)" << std::endl; - - return K; -} - -Matrix compute_do_ints(const BasisSet& bs1, const BasisSet& bs2, - bool use_2norm) { - return compute_schwarz_ints(bs1, bs2, use_2norm); -} - -std::tuple -compute_shellpairs(const BasisSet& bs1, - const BasisSet& _bs2, - const double threshold) { - const BasisSet& bs2 = (_bs2.empty() ? bs1 : _bs2); - const auto nsh1 = bs1.size(); - const auto nsh2 = bs2.size(); - const auto bs1_equiv_bs2 = (&bs1 == &bs2); - - using libint2::nthreads; - - // construct the overlap integral engines - using libint2::Engine; - std::vector engines; - engines.reserve(nthreads); - engines.emplace_back(Operator::overlap, - std::max(bs1.max_nprim(), bs2.max_nprim()), - std::max(bs1.max_l(), bs2.max_l()), 0); - engines[0].set_precision(0.); - for (size_t i = 1; i != nthreads; ++i) { - engines.push_back(engines[0]); - } - - std::cout << "computing non-negligible shell-pair list ... "; - - libint2::Timers<1> timer; - timer.set_now_overhead(25); - timer.start(0); - - shellpair_list_t splist; - - std::mutex mx; - - auto compute = [&](int thread_id) { - - auto& engine = engines[thread_id]; - const auto& buf = engine.results(); - - // loop over permutationally-unique set of shells - for (auto s1 = 0l, s12 = 0l; s1 != nsh1; ++s1) { - mx.lock(); - if (splist.find(s1) == splist.end()) - splist.insert(std::make_pair(s1, std::vector())); - mx.unlock(); - - auto n1 = bs1[s1].size(); // number of basis functions in this shell - - auto s2_max = bs1_equiv_bs2 ? s1 : nsh2 - 1; - for (auto s2 = 0; s2 <= s2_max; ++s2, ++s12) { - if (s12 % nthreads != thread_id) continue; - - auto on_same_center = (bs1[s1].O == bs2[s2].O); - bool significant = on_same_center; - if (not on_same_center) { - auto n2 = bs2[s2].size(); - engines[thread_id].compute(bs1[s1], bs2[s2]); - Eigen::Map buf_mat(buf[0], n1, n2); - auto norm = buf_mat.norm(); - significant = (norm >= threshold); - } - - if (significant) { - mx.lock(); - splist[s1].emplace_back(s2); - mx.unlock(); - } - } - } - }; // end of compute - - libint2::parallel_do(compute); - - // resort shell list in increasing order, i.e. splist[s][s1] < splist[s][s2] if s1 < s2 - // N.B. only parallelized over 1 shell index - auto sort = [&](int thread_id) { - for (auto s1 = 0l; s1 != nsh1; ++s1) { - if (s1 % nthreads == thread_id) { - auto& list = splist[s1]; - std::sort(list.begin(), list.end()); - } - } - }; // end of sort - - libint2::parallel_do(sort); - - // compute shellpair data assuming that we are computing to default_epsilon - // N.B. only parallelized over 1 shell index - const auto ln_max_engine_precision = std::log(max_engine_precision); - // assume shellpair data are used for Coulomb ints - for(auto&& eng: engines) { - eng.set(Operator::coulomb); - } - shellpair_data_t spdata(splist.size()); - auto make_spdata = [&](int thread_id) { - auto schwarz_factor_evaluator = [&](const Shell& s1, size_t p1, const Shell& s2, size_t p2) -> double { - auto& engine = engines[thread_id]; - auto& buf = engine.results(); - auto ps1 = s1.extract_primitive(p1, false); - auto ps2 = s2.extract_primitive(p2, false); - const auto n12 = ps1.size() * ps2.size(); - engine.compute(ps1, ps2, ps1, ps2); - if (buf[0]) { - Eigen::Map buf_mat(buf[0], n12, n12); - auto norm2 = screening_method == ScreeningMethod::SchwarzInf ? buf_mat.lpNorm() : buf_mat.norm(); - return std::sqrt(norm2); - } - else - return 0.; - }; - for (auto s1 = 0l; s1 != nsh1; ++s1) { - if (s1 % nthreads == thread_id) { - for (const auto &s2 : splist[s1]) { - if (screening_method == ScreeningMethod::Original || - screening_method == ScreeningMethod::Conservative) - spdata[s1].emplace_back(std::make_shared( - bs1[s1], bs2[s2], ln_max_engine_precision, screening_method)); - else { // Schwarz screening of primitives - spdata[s1].emplace_back(std::make_shared( - bs1[s1], bs2[s2], ln_max_engine_precision, screening_method, schwarz_factor_evaluator)); - } - } - } - } - }; // end of make_spdata - - libint2::parallel_do(make_spdata); - - timer.stop(0); - std::cout << "done (" << timer.read(0) << " s)" << std::endl; - - return std::make_tuple(splist,spdata); -} - -// returns {X,X^{-1},rank,A_condition_number,result_A_condition_number}, where -// X is the generalized square-root-inverse such that X.transpose() * A * X = I -// -// if symmetric is true, produce "symmetric" sqrtinv: X = U . A_evals_sqrtinv . -// U.transpose()), -// else produce "canonical" sqrtinv: X = U . A_evals_sqrtinv -// where U are eigenvectors of A -// rows and cols of symmetric X are equivalent; for canonical X the rows are -// original basis (AO), -// cols are transformed basis ("orthogonal" AO) -// -// A is conditioned to max_condition_number -std::tuple gensqrtinv( - const Matrix& S, bool symmetric = false, - double max_condition_number = 1e8) { - Eigen::SelfAdjointEigenSolver eig_solver(S); - auto U = eig_solver.eigenvectors(); - auto s = eig_solver.eigenvalues(); - auto s_max = s.maxCoeff(); - auto condition_number = std::min( - s_max / std::max(s.minCoeff(), std::numeric_limits::min()), - 1.0 / std::numeric_limits::epsilon()); - auto threshold = s_max / max_condition_number; - long n = s.rows(); - long n_cond = 0; - for (long i = n - 1; i >= 0; --i) { - if (s(i) >= threshold) { - ++n_cond; - } else - i = 0; // skip rest since eigenvalues are in ascending order - } - - auto sigma = s.bottomRows(n_cond); - auto result_condition_number = sigma.maxCoeff() / sigma.minCoeff(); - auto sigma_sqrt = sigma.array().sqrt().matrix().asDiagonal(); - auto sigma_invsqrt = sigma.array().sqrt().inverse().matrix().asDiagonal(); - - // make canonical X/Xinv - auto U_cond = U.block(0, n - n_cond, n, n_cond); - Matrix X = U_cond * sigma_invsqrt; - Matrix Xinv = U_cond * sigma_sqrt; - // convert to symmetric, if needed - if (symmetric) { - X = X * U_cond.transpose(); - Xinv = Xinv * U_cond.transpose(); - } - return std::make_tuple(X, Xinv, size_t(n_cond), condition_number, - result_condition_number); -} - -std::tuple conditioning_orthogonalizer( - const Matrix& S, double S_condition_number_threshold) { - size_t obs_rank; - double S_condition_number; - double XtX_condition_number; - Matrix X, Xinv; - - assert(S.rows() == S.cols()); - - std::tie(X, Xinv, obs_rank, S_condition_number, XtX_condition_number) = - gensqrtinv(S, false, S_condition_number_threshold); - auto obs_nbf_omitted = (long)S.rows() - (long)obs_rank; - std::cout << "overlap condition number = " << S_condition_number; - if (obs_nbf_omitted > 0) - std::cout << " (dropped " << obs_nbf_omitted << " " - << (obs_nbf_omitted > 1 ? "fns" : "fn") << " to reduce to " - << XtX_condition_number << ")"; - std::cout << std::endl; - - if (obs_nbf_omitted > 0) { - Matrix should_be_I = X.transpose() * S * X; - Matrix I = Matrix::Identity(should_be_I.rows(), should_be_I.cols()); - std::cout << "||X^t * S * X - I||_2 = " << (should_be_I - I).norm() - << " (should be 0)" << std::endl; - } - - return std::make_tuple(X, Xinv, XtX_condition_number); -} - -Matrix compute_2body_2index_ints(const BasisSet& bs) { - using libint2::nthreads; - const auto n = bs.nbf(); - const auto nshells = bs.size(); - Matrix result = Matrix::Zero(n, n); - - // build engines for each thread - using libint2::Engine; - std::vector engines(nthreads); - engines[0] = - Engine(libint2::Operator::coulomb, bs.max_nprim(), bs.max_l(), 0); - engines[0].set(BraKet::xs_xs); - engines[0].set(ScreeningMethod::Conservative); - for (size_t i = 1; i != nthreads; ++i) { - engines[i] = engines[0]; - } - - auto shell2bf = bs.shell2bf(); - auto unitshell = Shell::unit(); - - auto compute = [&](int thread_id) { - - auto& engine = engines[thread_id]; - const auto& buf = engine.results(); - - // loop over unique shell pairs, {s1,s2} such that s1 >= s2 - // this is due to the permutational symmetry of the real integrals over - // Hermitian operators: (1|2) = (2|1) - for (auto s1 = 0l, s12 = 0l; s1 != nshells; ++s1) { - auto bf1 = shell2bf[s1]; // first basis function in this shell - auto n1 = bs[s1].size(); - - for (auto s2 = 0; s2 <= s1; ++s2, ++s12) { - if (s12 % nthreads != thread_id) continue; - - auto bf2 = shell2bf[s2]; - auto n2 = bs[s2].size(); - - // compute shell pair; return is the pointer to the buffer - engine.compute(bs[s1], bs[s2]); - if (buf[0] == nullptr) - continue; // if all integrals screened out, skip to next shell set - - // "map" buffer to a const Eigen Matrix, and copy it to the - // corresponding blocks of the result - Eigen::Map buf_mat(buf[0], n1, n2); - result.block(bf1, bf2, n1, n2) = buf_mat; - if (s1 != s2) // if s1 >= s2, copy {s1,s2} to the corresponding {s2,s1} - // block, note the transpose! - result.block(bf2, bf1, n2, n1) = buf_mat.transpose(); - } - } - }; // compute lambda - - libint2::parallel_do(compute); - - return result; -} - -Matrix compute_2body_fock(const BasisSet& obs, const Matrix& D, - double precision, const Matrix& Schwarz) { - const auto n = obs.nbf(); - const auto nshells = obs.size(); - using libint2::nthreads; - std::vector G(nthreads, Matrix::Zero(n, n)); - - const auto do_schwarz_screen = Schwarz.cols() != 0 && Schwarz.rows() != 0; - Matrix D_shblk_norm = - compute_shellblock_norm(obs, D); // matrix of infty-norms of shell blocks - - auto fock_precision = precision; - // standard approach is to omit *contributions* to the Fock matrix smaller than fock_precision ... this relies on massive amount of error cancellation - auto max_nprim = obs.max_nprim(); - auto needed_engine_precision = (fock_precision / D_shblk_norm.maxCoeff()); - assert(needed_engine_precision > max_engine_precision && - "using precomputed shell pair data limits the max engine precision" - " ... make max_engine_precision smaller and recompile"); - - // construct the 2-electron repulsion integrals engine pool - using libint2::Engine; - std::vector engines(nthreads); - engines[0] = Engine(Operator::coulomb, obs.max_nprim(), obs.max_l(), 0); - engines[0].set(screening_method); - engines[0].set_precision(needed_engine_precision); // N.B. precision will be adjusted for each shellset - std::cout << "compute_2body_fock:precision = " << precision << std::endl; - std::cout << "will set Engine::precision as low as = " << engines[0].precision() << std::endl; - for (size_t i = 1; i != nthreads; ++i) { - engines[i] = engines[0]; - } - std::atomic num_ints_computed{0}; - -#if defined(REPORT_INTEGRAL_TIMINGS) - std::vector> timers(nthreads); -#endif - - auto shell2bf = obs.shell2bf(); - - auto lambda = [&](int thread_id) { - - auto& engine = engines[thread_id]; - auto& g = G[thread_id]; - const auto& buf = engine.results(); - -#if defined(REPORT_INTEGRAL_TIMINGS) - auto& timer = timers[thread_id]; - timer.clear(); - timer.set_now_overhead(25); -#endif - - // loop over permutationally-unique set of shells - for (auto s1 = 0l, s1234 = 0l; s1 != nshells; ++s1) { - auto bf1_first = shell2bf[s1]; // first basis function in this shell - auto n1 = obs[s1].size(); // number of basis functions in this shell - - auto sp12_iter = obs_shellpair_data.at(s1).begin(); - - for (const auto& s2 : obs_shellpair_list[s1]) { - auto bf2_first = shell2bf[s2]; - auto n2 = obs[s2].size(); - - const auto* sp12 = sp12_iter->get(); - ++sp12_iter; - - const auto Dnorm12 = do_schwarz_screen ? D_shblk_norm(s1, s2) : 0.; - - for (auto s3 = 0; s3 <= s1; ++s3) { - auto bf3_first = shell2bf[s3]; - auto n3 = obs[s3].size(); - - const auto Dnorm123 = - do_schwarz_screen - ? std::max(D_shblk_norm(s1, s3), - std::max(D_shblk_norm(s2, s3), Dnorm12)) - : 0.; - - auto sp34_iter = obs_shellpair_data.at(s3).begin(); - - const auto s4_max = (s1 == s3) ? s2 : s3; - for (const auto& s4 : obs_shellpair_list[s3]) { - if (s4 > s4_max) - break; // for each s3, s4 are stored in monotonically increasing - // order - - // must update the iter even if going to skip s4 - const auto* sp34 = sp34_iter->get(); - ++sp34_iter; - - if ((s1234++) % nthreads != thread_id) continue; - - const auto Dnorm1234 = - do_schwarz_screen - ? std::max( - D_shblk_norm(s1, s4), - std::max(D_shblk_norm(s2, s4), - std::max(D_shblk_norm(s3, s4), Dnorm123))) - : 0.; - - if (do_schwarz_screen && - Dnorm1234 * Schwarz(s1, s2) * Schwarz(s3, s4) < - fock_precision) - continue; - - auto bf4_first = shell2bf[s4]; - auto n4 = obs[s4].size(); - - // compute the permutational degeneracy (i.e. # of equivalents) of - // the given shell set - auto s12_deg = (s1 == s2) ? 1 : 2; - auto s34_deg = (s3 == s4) ? 1 : 2; - auto s12_34_deg = (s1 == s3) ? (s2 == s4 ? 1 : 2) : 2; - auto s1234_deg = s12_deg * s34_deg * s12_34_deg; - -#if defined(REPORT_INTEGRAL_TIMINGS) - timer.start(0); -#endif - - // vary precision for each shellset to guarantee precision of the contribution to the Fock matrix - engine.set_precision(Dnorm1234 != 0. ? fock_precision / Dnorm1234 : needed_engine_precision); - engine.compute2( - obs[s1], obs[s2], obs[s3], obs[s4], sp12, sp34); - const auto* buf_1234 = buf[0]; - if (buf_1234 == nullptr) - continue; // if all integrals screened out, skip to next quartet - - num_ints_computed += n1 * n2 * n3 * n4; - -#if defined(REPORT_INTEGRAL_TIMINGS) - timer.stop(0); -#endif - - // 1) each shell set of integrals contributes up to 6 shell sets of - // the Fock matrix: - // F(a,b) += (ab|cd) * D(c,d) - // F(c,d) += (ab|cd) * D(a,b) - // F(b,d) -= 1/4 * (ab|cd) * D(a,c) - // F(b,c) -= 1/4 * (ab|cd) * D(a,d) - // F(a,c) -= 1/4 * (ab|cd) * D(b,d) - // F(a,d) -= 1/4 * (ab|cd) * D(b,c) - // 2) each permutationally-unique integral (shell set) must be - // scaled by its degeneracy, - // i.e. the number of the integrals/sets equivalent to it - // 3) the end result must be symmetrized - for (auto f1 = 0, f1234 = 0; f1 != n1; ++f1) { - const auto bf1 = f1 + bf1_first; - for (auto f2 = 0; f2 != n2; ++f2) { - const auto bf2 = f2 + bf2_first; - for (auto f3 = 0; f3 != n3; ++f3) { - const auto bf3 = f3 + bf3_first; - for (auto f4 = 0; f4 != n4; ++f4, ++f1234) { - const auto bf4 = f4 + bf4_first; - - const auto value = buf_1234[f1234]; - - const auto value_scal_by_deg = value * s1234_deg; - - g(bf1, bf2) += D(bf3, bf4) * value_scal_by_deg; - g(bf3, bf4) += D(bf1, bf2) * value_scal_by_deg; - g(bf1, bf3) -= 0.25 * D(bf2, bf4) * value_scal_by_deg; - g(bf2, bf4) -= 0.25 * D(bf1, bf3) * value_scal_by_deg; - g(bf1, bf4) -= 0.25 * D(bf2, bf3) * value_scal_by_deg; - g(bf2, bf3) -= 0.25 * D(bf1, bf4) * value_scal_by_deg; - } - } - } - } - } - } - } - } - - }; // end of lambda - - libint2::parallel_do(lambda); - - // accumulate contributions from all threads - for (size_t i = 1; i != nthreads; ++i) { - G[0] += G[i]; - } - -#if defined(REPORT_INTEGRAL_TIMINGS) - double time_for_ints = 0.0; - for (auto& t : timers) { - time_for_ints += t.read(0); - } - std::cout << "time for integrals = " << time_for_ints << std::endl; - for (int t = 0; t != nthreads; ++t) engines[t].print_timers(); -#endif - - Matrix GG = 0.5 * (G[0] + G[0].transpose()); - - std::cout << "# of integrals = " << num_ints_computed << std::endl; - - // symmetrize the result and return - return GG; -} - -#if LIBINT2_DERIV_ERI_ORDER -template -std::vector compute_2body_fock_deriv(const BasisSet& obs, - const std::vector& atoms, - const Matrix& D, double precision, - const Matrix& Schwarz) { - const auto n = obs.nbf(); - const auto nshells = obs.size(); - const auto nderiv_shellset = - libint2::num_geometrical_derivatives(4, deriv_order); // # of derivs for each shell quartet - const auto nderiv = libint2::num_geometrical_derivatives( - atoms.size(), deriv_order); // total # of derivs - const auto ncoords_times_two = (atoms.size() * 3) * 2; - using libint2::nthreads; - std::vector G(nthreads * nderiv, Matrix::Zero(n, n)); - - const auto do_schwarz_screen = Schwarz.cols() != 0 && Schwarz.rows() != 0; - Matrix D_shblk_norm = - compute_shellblock_norm(obs, D); // matrix of infty-norms of shell blocks - - auto fock_precision = precision; - // standard approach is to omit *contributions* to the Fock matrix smaller than fock_precision ... this relies on massive amount of error cancellation - auto max_nprim = obs.max_nprim(); - auto needed_engine_precision = (fock_precision / D_shblk_norm.maxCoeff()); - assert(needed_engine_precision > max_engine_precision && - "using precomputed shell pair data limits the max engine precision" - " ... make max_engine_precision smaller and recompile"); - - // construct the 2-electron repulsion integrals engine pool - using libint2::Engine; - std::vector engines(nthreads); - engines[0] = - Engine(Operator::coulomb, obs.max_nprim(), obs.max_l(), deriv_order); - engines[0].set(screening_method); - engines[0].set_precision(needed_engine_precision); // N.B. precision will be adjusted for each shellset - std::cout << "compute_2body_fock:precision = " << precision << std::endl; - std::cout << "will set Engine::precision as low as = " << engines[0].precision() << std::endl; - for (size_t i = 1; i != nthreads; ++i) { - engines[i] = engines[0]; - } - std::atomic num_ints_computed{0}; - -#if defined(REPORT_INTEGRAL_TIMINGS) - std::vector> timers(nthreads); -#endif - - auto shell2bf = obs.shell2bf(); - auto shell2atom = obs.shell2atom(atoms); - - auto lambda = [&](int thread_id) { - - auto& engine = engines[thread_id]; - const auto& buf = engine.results(); - -#if defined(REPORT_INTEGRAL_TIMINGS) - auto& timer = timers[thread_id]; - timer.clear(); - timer.set_now_overhead(25); -#endif - - size_t shell_atoms[4]; - - // loop over permutationally-unique set of shells - for (auto s1 = 0l, s1234 = 0l; s1 != nshells; ++s1) { - auto bf1_first = shell2bf[s1]; // first basis function in this shell - auto n1 = obs[s1].size(); // number of basis functions in this shell - shell_atoms[0] = shell2atom[s1]; - - auto sp12_iter = obs_shellpair_data.at(s1).begin(); - - for (const auto& s2 : obs_shellpair_list[s1]) { - auto bf2_first = shell2bf[s2]; - auto n2 = obs[s2].size(); - shell_atoms[1] = shell2atom[s2]; - - const auto* sp12 = sp12_iter->get(); - ++sp12_iter; - - const auto Dnorm12 = do_schwarz_screen ? D_shblk_norm(s1, s2) : 0.; - - for (auto s3 = 0; s3 <= s1; ++s3) { - auto bf3_first = shell2bf[s3]; - auto n3 = obs[s3].size(); - shell_atoms[2] = shell2atom[s3]; - - const auto Dnorm123 = - do_schwarz_screen - ? std::max(D_shblk_norm(s1, s3), - std::max(D_shblk_norm(s2, s3), Dnorm12)) - : 0.; - - auto sp34_iter = obs_shellpair_data.at(s3).begin(); - - const auto s4_max = (s1 == s3) ? s2 : s3; - for (const auto& s4 : obs_shellpair_list[s3]) { - if (s4 > s4_max) - break; // for each s3, s4 are stored in monotonically increasing - // order - - // must update the iter even if going to skip s4 - const auto* sp34 = sp34_iter->get(); - ++sp34_iter; - - if ((s1234++) % nthreads != thread_id) continue; - - const auto Dnorm1234 = - do_schwarz_screen - ? std::max( - D_shblk_norm(s1, s4), - std::max(D_shblk_norm(s2, s4), - std::max(D_shblk_norm(s3, s4), Dnorm123))) - : 0.; - - if (do_schwarz_screen && - Dnorm1234 * Schwarz(s1, s2) * Schwarz(s3, s4) < - fock_precision) - continue; - - auto bf4_first = shell2bf[s4]; - auto n4 = obs[s4].size(); - shell_atoms[3] = shell2atom[s4]; - - const auto n1234 = n1 * n2 * n3 * n4; - - // compute the permutational degeneracy (i.e. # of equivalents) of - // the given shell set - auto s12_deg = (s1 == s2) ? 1.0 : 2.0; - auto s34_deg = (s3 == s4) ? 1.0 : 2.0; - auto s12_34_deg = (s1 == s3) ? (s2 == s4 ? 1.0 : 2.0) : 2.0; - auto s1234_deg = s12_deg * s34_deg * s12_34_deg; - - // computes contribution from shell set \c idx to the operator matrix with - // index \c op - auto add_shellset_to_dest = [&]( - std::size_t op, std::size_t idx, int coord1, int coord2, double scale = 1.0) { - auto& g = G[op]; - auto shset = buf[idx]; - const auto weight = scale * s1234_deg; - - for (auto f1 = 0, f1234 = 0; f1 != n1; ++f1) { - const auto bf1 = f1 + bf1_first; - for (auto f2 = 0; f2 != n2; ++f2) { - const auto bf2 = f2 + bf2_first; - for (auto f3 = 0; f3 != n3; ++f3) { - const auto bf3 = f3 + bf3_first; - for (auto f4 = 0; f4 != n4; ++f4, ++f1234) { - const auto bf4 = f4 + bf4_first; - - const auto value = shset[f1234]; - const auto wvalue = value * weight; - - g(bf1, bf2) += D(bf3, bf4) * wvalue; - g(bf3, bf4) += D(bf1, bf2) * wvalue; - g(bf1, bf3) -= 0.25 * D(bf2, bf4) * wvalue; - g(bf2, bf4) -= 0.25 * D(bf1, bf3) * wvalue; - g(bf1, bf4) -= 0.25 * D(bf2, bf3) * wvalue; - g(bf2, bf3) -= 0.25 * D(bf1, bf4) * wvalue; - } - } - } - } - }; - -#if defined(REPORT_INTEGRAL_TIMINGS) - timer.start(0); -#endif - - // vary precision for each shellset to guarantee precision of the contribution to the Fock matrix - engine.set_precision(Dnorm1234 != 0. ? fock_precision / Dnorm1234 : needed_engine_precision); - engine.compute2( - obs[s1], obs[s2], obs[s3], obs[s4], sp12, sp34); - if (buf[0] == nullptr) - continue; // if all integrals screened out, skip to next quartet - num_ints_computed += nderiv_shellset * n1234; - -#if defined(REPORT_INTEGRAL_TIMINGS) - timer.stop(0); -#endif - - switch (deriv_order) { - case 0: { - int coord1 = 0, coord2 = 0; - add_shellset_to_dest(thread_id, 0, coord1, coord2); - } break; - - case 1: { - for (auto d = 0; d != 12; ++d) { - const int a = d / 3; - const int xyz = d % 3; - - auto coord = shell_atoms[a] * 3 + xyz; - auto& g = G[thread_id * nderiv + coord]; - - int coord1 = 0, coord2 = 0; - - add_shellset_to_dest(thread_id * nderiv + coord, d, coord1, coord2); - - } // d \in [0,12) - } break; - - case 2: { - // computes upper triangle index - // n2 = matrix size times 2 - // i,j = (unordered) indices - auto upper_triangle_index = [](size_t n2, size_t i, size_t j) { - return std::min(i, j) * (n2 - (std::min(i, j)) - 1) / 2 + std::max(i, j); - }; - // look over shellsets in the order in which they appear - std::size_t shellset_idx = 0; - for (auto c1 = 0; c1 != 4; ++c1) { - auto a1 = shell_atoms[c1]; - auto coord1 = 3 * a1; - for (auto xyz1 = 0; xyz1 != 3; ++xyz1, ++coord1) { - for (auto c2 = c1; c2 != 4; ++c2) { - auto a2 = shell_atoms[c2]; - auto xyz2_start = (c1 == c2) ? xyz1 : 0; - auto coord2 = 3 * a2 + xyz2_start; - for (auto xyz2 = xyz2_start; xyz2 != 3; - ++xyz2, ++coord2) { - double scale = - (coord1 == coord2 && c1 != c2) ? 2.0 : 1.0; - - const auto coord12 = upper_triangle_index( - ncoords_times_two, coord1, coord2); - auto op = thread_id * nderiv + coord12; - add_shellset_to_dest(op, shellset_idx, coord1, coord2, scale); - ++shellset_idx; - } - } - } - } - } break; - - default: - assert(deriv_order <= 2 && - "support for 3rd and higher derivatives of the Fock " - "matrix not yet implemented"); - } - } - } - } - } - - }; // end of lambda - - libint2::parallel_do(lambda); - - // accumulate contributions from all threads - for (size_t t = 1; t != nthreads; ++t) { - for (auto d = 0; d != nderiv; ++d) { - G[d] += G[t * nderiv + d]; - } - } - -#if defined(REPORT_INTEGRAL_TIMINGS) - double time_for_ints = 0.0; - for (auto& t : timers) { - time_for_ints += t.read(0); - } - std::cout << "time for integrals = " << time_for_ints << std::endl; - for (int t = 0; t != nthreads; ++t) engines[t].print_timers(); -#endif - - std::vector GG(nderiv); - for (auto d = 0; d != nderiv; ++d) { - GG[d] = 0.5 * (G[d] + G[d].transpose()); - } - - std::cout << "# of integrals = " << num_ints_computed << std::endl; - - // symmetrize the result and return - return GG; -} - -#endif - -Matrix compute_2body_fock_general(const BasisSet& obs, const Matrix& D, - const BasisSet& D_bs, bool D_is_shelldiagonal, - double precision) { - const auto n = obs.nbf(); - const auto nshells = obs.size(); - const auto n_D = D_bs.nbf(); - assert(D.cols() == D.rows() && D.cols() == n_D); - - using libint2::nthreads; - std::vector G(nthreads, Matrix::Zero(n, n)); - - // construct the 2-electron repulsion integrals engine - using libint2::Engine; - std::vector engines(nthreads); - engines[0] = Engine(libint2::Operator::coulomb, - std::max(obs.max_nprim(), D_bs.max_nprim()), - std::max(obs.max_l(), D_bs.max_l()), 0); - engines[0].set_precision(precision); - for (size_t i = 1; i != nthreads; ++i) { - engines[i] = engines[0]; - } - auto shell2bf = obs.shell2bf(); - auto shell2bf_D = D_bs.shell2bf(); - - auto lambda = [&](int thread_id) { - - auto& engine = engines[thread_id]; - auto& g = G[thread_id]; - const auto& buf = engine.results(); - - // loop over permutationally-unique set of shells - for (auto s1 = 0l, s1234 = 0l; s1 != nshells; ++s1) { - auto bf1_first = shell2bf[s1]; // first basis function in this shell - auto n1 = obs[s1].size(); // number of basis functions in this shell - - for (auto s2 = 0; s2 <= s1; ++s2) { - auto bf2_first = shell2bf[s2]; - auto n2 = obs[s2].size(); - - for (auto s3 = 0; s3 < D_bs.size(); ++s3) { - auto bf3_first = shell2bf_D[s3]; - auto n3 = D_bs[s3].size(); - - auto s4_begin = D_is_shelldiagonal ? s3 : 0; - auto s4_fence = D_is_shelldiagonal ? s3 + 1 : D_bs.size(); - - for (auto s4 = s4_begin; s4 != s4_fence; ++s4, ++s1234) { - if (s1234 % nthreads != thread_id) continue; - - auto bf4_first = shell2bf_D[s4]; - auto n4 = D_bs[s4].size(); - - // compute the permutational degeneracy (i.e. # of equivalents) of - // the given shell set - auto s12_deg = (s1 == s2) ? 1.0 : 2.0; - - if (s3 >= s4) { - auto s34_deg = (s3 == s4) ? 1.0 : 2.0; - auto s1234_deg = s12_deg * s34_deg; - // auto s1234_deg = s12_deg; - engine.compute2( - obs[s1], obs[s2], D_bs[s3], D_bs[s4]); - const auto* buf_1234 = buf[0]; - if (buf_1234 != nullptr) { - for (auto f1 = 0, f1234 = 0; f1 != n1; ++f1) { - const auto bf1 = f1 + bf1_first; - for (auto f2 = 0; f2 != n2; ++f2) { - const auto bf2 = f2 + bf2_first; - for (auto f3 = 0; f3 != n3; ++f3) { - const auto bf3 = f3 + bf3_first; - for (auto f4 = 0; f4 != n4; ++f4, ++f1234) { - const auto bf4 = f4 + bf4_first; - - const auto value = buf_1234[f1234]; - const auto value_scal_by_deg = value * s1234_deg; - g(bf1, bf2) += 2.0 * D(bf3, bf4) * value_scal_by_deg; - } - } - } - } - } - } - - engine.compute2( - obs[s1], D_bs[s3], obs[s2], D_bs[s4]); - const auto* buf_1324 = buf[0]; - if (buf_1324 == nullptr) - continue; // if all integrals screened out, skip to next quartet - - for (auto f1 = 0, f1324 = 0; f1 != n1; ++f1) { - const auto bf1 = f1 + bf1_first; - for (auto f3 = 0; f3 != n3; ++f3) { - const auto bf3 = f3 + bf3_first; - for (auto f2 = 0; f2 != n2; ++f2) { - const auto bf2 = f2 + bf2_first; - for (auto f4 = 0; f4 != n4; ++f4, ++f1324) { - const auto bf4 = f4 + bf4_first; - - const auto value = buf_1324[f1324]; - const auto value_scal_by_deg = value * s12_deg; - g(bf1, bf2) -= D(bf3, bf4) * value_scal_by_deg; - } - } - } - } - } - } - } - } - - }; // thread lambda - - libint2::parallel_do(lambda); - - // accumulate contributions from all threads - for (size_t i = 1; i != nthreads; ++i) { - G[0] += G[i]; - } - - // symmetrize the result and return - return 0.5 * (G[0] + G[0].transpose()); -} - -#ifdef HAVE_DENSITY_FITTING - -Matrix DFFockEngine::compute_2body_fock_dfC(const Matrix& Cocc) { - - using libint2::nthreads; - - const auto n = obs.nbf(); - const auto ndf = dfbs.nbf(); - - libint2::Timers<1> wall_timer; - wall_timer.set_now_overhead(25); - std::vector> timers(nthreads); - for(auto& timer: timers) timer.set_now_overhead(25); - - typedef btas::RangeNd> Range1d; - typedef btas::RangeNd> Range2d; - typedef btas::Tensor Tensor1d; - typedef btas::Tensor Tensor2d; - - // using first time? compute 3-center ints and transform to inv sqrt - // representation - if (xyK.size() == 0) { - - wall_timer.start(0); - - const auto nshells = obs.size(); - const auto nshells_df = dfbs.size(); - const auto& unitshell = libint2::Shell::unit(); - - // construct the 2-electron 3-center repulsion integrals engine - // since the code assumes (xx|xs) braket, and Engine/libint only produces - // (xs|xx), use 4-center engine - std::vector engines(nthreads); - engines[0] = libint2::Engine(libint2::Operator::coulomb, - std::max(obs.max_nprim(), dfbs.max_nprim()), - std::max(obs.max_l(), dfbs.max_l()), 0); - engines[0].set(BraKet::xs_xx); - for (size_t i = 1; i != nthreads; ++i) { - engines[i] = engines[0]; - } - - auto shell2bf = obs.shell2bf(); - auto shell2bf_df = dfbs.shell2bf(); - - Tensor3d Zxy{ndf, n, n}; - - auto lambda = [&](int thread_id) { - - auto& engine = engines[thread_id]; - auto& timer = timers[thread_id]; - const auto& results = engine.results(); - - // loop over permutationally-unique set of shells - for (auto s1 = 0l, s123 = 0l; s1 != nshells_df; ++s1) { - auto bf1_first = shell2bf_df[s1]; // first basis function in this shell - auto n1 = dfbs[s1].size(); // number of basis functions in this shell - - for (auto s2 = 0; s2 != nshells; ++s2) { - auto bf2_first = shell2bf[s2]; - auto n2 = obs[s2].size(); - const auto n12 = n1 * n2; - - for (auto s3 = 0; s3 != nshells; ++s3, ++s123) { - if (s123 % nthreads != thread_id) continue; - - auto bf3_first = shell2bf[s3]; - auto n3 = obs[s3].size(); - const auto n123 = n12 * n3; - - timer.start(0); - - engine.compute2( - dfbs[s1], unitshell, obs[s2], obs[s3]); - const auto* buf = results[0]; - if (buf == nullptr) - continue; - - timer.stop(0); - timer.start(1); - - auto lower_bound = {bf1_first, bf2_first, bf3_first}; - auto upper_bound = {bf1_first + n1, bf2_first + n2, bf3_first + n3}; - auto view = btas::make_view( - Zxy.range().slice(lower_bound, upper_bound), Zxy.storage()); - std::copy(buf, buf + n123, view.begin()); - - timer.stop(1); - } // s3 - } // s2 - } // s1 - - }; // lambda - - libint2::parallel_do(lambda); - - wall_timer.stop(0); - - double ints_time = 0; - for(const auto& timer: timers) ints_time += timer.read(0); - std::cout << "time for Zxy integrals = " << ints_time << " (total from all threads)" << std::endl; - double copy_time = 0; - for(const auto& timer: timers) copy_time += timer.read(1); - std::cout << "time for copying into BTAS = " << copy_time << " (total from all threads)"<< std::endl; - std::cout << "wall time for Zxy integrals + copy = " << wall_timer.read(0) << std::endl; - - timers[0].start(2); - - Matrix V = compute_2body_2index_ints(dfbs); - Eigen::LLT V_LLt(V); - Matrix I = Matrix::Identity(ndf, ndf); - auto L = V_LLt.matrixL(); - Matrix V_L = L; - Matrix Linv_t = L.solve(I).transpose(); - // check - // std::cout << "||V - L L^t|| = " << (V - V_L * V_L.transpose()).norm() << - // std::endl; - // std::cout << "||I - L L^-1|| = " << (I - V_L * - // Linv_t.transpose()).norm() << std::endl; - // std::cout << "||V^-1 - L^-1^t L^-1|| = " << (V.inverse() - Linv_t * - // Linv_t.transpose()).norm() << std::endl; - - Tensor2d K{ndf, ndf}; - std::copy(Linv_t.data(), Linv_t.data() + ndf * ndf, K.begin()); - - xyK = Tensor3d{n, n, ndf}; - btas::contract(1.0, Zxy, {1, 2, 3}, K, {1, 4}, 0.0, xyK, {2, 3, 4}); - Zxy = Tensor3d{0, 0, 0}; // release memory - - timers[0].stop(2); - std::cout << "time for integrals metric tform = " << timers[0].read(2) - << std::endl; - } // if (xyK.size() == 0) - - // compute exchange - timers[0].start(3); - - const auto nocc = Cocc.cols(); - Tensor2d Co{n, nocc}; - std::copy(Cocc.data(), Cocc.data() + n * nocc, Co.begin()); - Tensor3d xiK{n, nocc, ndf}; - btas::contract(1.0, xyK, {1, 2, 3}, Co, {2, 4}, 0.0, xiK, {1, 4, 3}); - - Tensor2d G{n, n}; - btas::contract(1.0, xiK, {1, 2, 3}, xiK, {4, 2, 3}, 0.0, G, {1, 4}); - - timers[0].stop(3); - std::cout << "time for exchange = " << timers[0].read(3) << std::endl; - - // compute Coulomb - timers[0].start(4); - - Tensor1d Jtmp{ndf}; - btas::contract(1.0, xiK, {1, 2, 3}, Co, {1, 2}, 0.0, Jtmp, {3}); - xiK = Tensor3d{0, 0, 0}; - btas::contract(2.0, xyK, {1, 2, 3}, Jtmp, {3}, -1.0, G, {1, 2}); - - timers[0].stop(4); - std::cout << "time for coulomb = " << timers[0].read(4) << std::endl; - - // copy result to an Eigen::Matrix - Matrix result(n, n); - std::copy(G.cbegin(), G.cend(), result.data()); - return result; -} -#endif // HAVE_DENSITY_FITTING - -// should be a unit test somewhere -void api_basic_compile_test(const BasisSet& obs, - const std::vector& atoms) { - using namespace libint2; - Engine onebody_engine( - Operator::overlap, // will compute overlap ints - obs.max_nprim(), // max # of primitives in shells this engine will - // accept - obs.max_l() // max angular momentum of shells this engine will accept - ); - auto shell2bf = obs.shell2bf(); - const auto& results = onebody_engine.results(); - for (auto s1 = 0; s1 != obs.size(); ++s1) { - for (auto s2 = 0; s2 != obs.size(); ++s2) { - std::cout << "compute shell set {" << s1 << "," << s2 << "} ... "; - onebody_engine.compute(obs[s1], obs[s2]); - const auto* ints_shellset = results[0]; - std::cout << "done" << std::endl; - - auto bf1 = shell2bf[s1]; // first basis function in first shell - auto n1 = obs[s1].size(); // number of basis functions in first shell - auto bf2 = shell2bf[s2]; // first basis function in second shell - auto n2 = obs[s2].size(); // number of basis functions in second shell - - // this iterates over integrals in the order they are packed in array - // ints_shellset - for (auto f1 = 0; f1 != n1; ++f1) - for (auto f2 = 0; f2 != n2; ++f2) - std::cout << " " << bf1 + f1 << " " << bf2 + f2 << " " - << ints_shellset[f1 * n2 + f2] << std::endl; - } - } - - using libint2::Operator; - - std::vector> cgtg_params{ - {0.1, 0.2}, {0.3, 0.4}, {0.5, 0.6}}; - { - auto K = - compute_schwarz_ints(obs, obs, false, cgtg_params); - std::cout << "cGTG Schwarz ints\n" << K << std::endl; - } - { - auto K = compute_schwarz_ints(obs, obs, false, - cgtg_params); - std::cout << "cGTG/r12 Schwarz ints\n" << K << std::endl; - } - { - auto K = - compute_schwarz_ints(obs, obs, false, cgtg_params); - std::cout << "||Del.cGTG||^2 Schwarz ints\n" << K << std::endl; - } - double attenuation_omega = 1.0; - { - auto K = - compute_schwarz_ints(obs, obs, false, attenuation_omega); - std::cout << "erfc_coulomb Schwarz ints\n" << K << std::endl; - } - { - auto K = - compute_schwarz_ints(obs, obs, false, attenuation_omega); - std::cout << "erf_coulomb Schwarz ints\n" << K << std::endl; - } - { - auto V = compute_1body_ints( - obs, - libint2::make_point_charges(atoms))[0]; - std::cout << "nuclear ints\n" << V << std::endl; - auto V_erfc = compute_1body_ints( - obs, - std::make_tuple(attenuation_omega, libint2::make_point_charges(atoms)))[0]; - std::cout << "erfc_nuclear ints\n" << V_erfc << std::endl; - auto V_erf = compute_1body_ints( - obs, - std::make_tuple(attenuation_omega, libint2::make_point_charges(atoms)))[0]; - std::cout << "erf_nuclear ints\n" << V_erf << std::endl; - std::cout << "V - (V_erfc + V_erf)" << Matrix(V - V_erfc - V_erf) << std::endl; - } - - { // test 2-index ints - Engine eri4_engine(Operator::coulomb, obs.max_nprim(), obs.max_l()); - Engine eri2_engine = eri4_engine; - eri2_engine.set(BraKet::xs_xs); - auto shell2bf = obs.shell2bf(); - const auto& results4 = eri4_engine.results(); - const auto& results2 = eri2_engine.results(); - for (auto s1 = 0; s1 != obs.size(); ++s1) { - for (auto s2 = 0; s2 != obs.size(); ++s2) { - eri4_engine.compute(obs[s1], Shell::unit(), obs[s2], Shell::unit()); - eri2_engine.compute(obs[s1], obs[s2]); - - auto bf1 = shell2bf[s1]; // first basis function in first shell - auto n1 = obs[s1].size(); // number of basis functions in first shell - auto bf2 = shell2bf[s2]; // first basis function in second shell - auto n2 = obs[s2].size(); // number of basis functions in second shell - - const auto* buf4 = results4[0]; - const auto* buf2 = results2[0]; - - // this iterates over integrals in the order they are packed in array - // ints_shellset - for (auto f1 = 0, f12 = 0; f1 != n1; ++f1) - for (auto f2 = 0; f2 != n2; ++f2, ++f12) - assert(std::abs(buf4[f12] - buf2[f12]) < 1e-12 && - "2-center ints test failed"); - } - } - } - { // test 3-index ints - Engine eri4_engine(Operator::coulomb, obs.max_nprim(), obs.max_l()); - Engine eri3_engine = eri4_engine; - eri3_engine.set(BraKet::xs_xx); - auto shell2bf = obs.shell2bf(); - const auto& results4 = eri4_engine.results(); - const auto& results3 = eri3_engine.results(); - for (auto s1 = 0; s1 != obs.size(); ++s1) { - for (auto s2 = 0; s2 != obs.size(); ++s2) { - for (auto s3 = 0; s3 != obs.size(); ++s3) { - eri4_engine.compute(obs[s1], Shell::unit(), obs[s2], obs[s3]); - eri3_engine.compute(obs[s1], obs[s2], obs[s3]); - - auto bf1 = shell2bf[s1]; // first basis function in first shell - auto n1 = obs[s1].size(); // number of basis functions in first shell - auto bf2 = shell2bf[s2]; // first basis function in second shell - auto n2 = - obs[s2].size(); // number of basis functions in second shell - auto bf3 = shell2bf[s3]; // first basis function in third shell - auto n3 = obs[s3].size(); // number of basis functions in third shell - - const auto* buf4 = results4[0]; - const auto* buf3 = results3[0]; - - // this iterates over integrals in the order they are packed in array - // ints_shellset - for (auto f1 = 0, f123 = 0; f1 != n1; ++f1) - for (auto f2 = 0; f2 != n2; ++f2) - for (auto f3 = 0; f3 != n3; ++f3, ++f123) - assert(std::abs(buf4[f123] - buf3[f123]) < 1e-12 && - "3-center ints test failed"); - } - } - } - } - -#if LIBINT2_DERIV_ERI_ORDER - { // test deriv 2-index ints - Engine eri4_engine(Operator::coulomb, obs.max_nprim(), obs.max_l(), 1); - Engine eri2_engine = eri4_engine; - eri2_engine.set(BraKet::xs_xs); - auto shell2bf = obs.shell2bf(); - const auto& results4 = eri4_engine.results(); - const auto& results2 = eri2_engine.results(); - for (auto s1 = 0; s1 != obs.size(); ++s1) { - for (auto s2 = 0; s2 != obs.size(); ++s2) { - eri4_engine.compute(obs[s1], Shell::unit(), obs[s2], Shell::unit()); - eri2_engine.compute(obs[s1], obs[s2]); - - auto bf1 = shell2bf[s1]; // first basis function in first shell - auto n1 = obs[s1].size(); // number of basis functions in first shell - auto bf2 = shell2bf[s2]; // first basis function in second shell - auto n2 = obs[s2].size(); // number of basis functions in second shell - - // loop over derivative shell sets - for(auto d=0; d!=6; ++d) { - const auto* buf4 = results4[d<3 ? d : d+3]; - const auto* buf2 = results2[d]; - - // this iterates over integrals in the order they are packed in array - // ints_shellset - for (auto f1 = 0, f12 = 0; f1 != n1; ++f1) - for (auto f2 = 0; f2 != n2; ++f2, ++f12) - assert(std::abs(buf4[f12] - buf2[f12]) < 1e-12 && - "deriv 2-center ints test failed"); - } - - } - } - } -#endif - -#if LIBINT2_DERIV_ERI_ORDER > 1 - { // test 2nd deriv 2-index ints - Engine eri4_engine(Operator::coulomb, obs.max_nprim(), obs.max_l(), 2); - Engine eri2_engine = eri4_engine; - eri2_engine.set(BraKet::xs_xs); - auto shell2bf = obs.shell2bf(); - const auto& results4 = eri4_engine.results(); - const auto& results2 = eri2_engine.results(); - for (auto s1 = 0; s1 != obs.size(); ++s1) { - for (auto s2 = 0; s2 != obs.size(); ++s2) { - eri4_engine.compute(obs[s1], Shell::unit(), obs[s2], Shell::unit()); - eri2_engine.compute(obs[s1], obs[s2]); - - auto bf1 = shell2bf[s1]; // first basis function in first shell - auto n1 = obs[s1].size(); // number of basis functions in first shell - auto bf2 = shell2bf[s2]; // first basis function in second shell - auto n2 = obs[s2].size(); // number of basis functions in second shell - - // loop over derivative shell sets - for (auto d1 = 0, d12 = 0; d1 != 6; ++d1) { - const auto dd1 = d1 < 3 ? d1 : d1 + 3; - for (auto d2 = d1; d2 != 6; ++d2, ++d12) { - const auto dd2 = d2 < 3 ? d2 : d2 + 3; - const auto dd12 = dd1 * (24 - dd1 - 1) / 2 + dd2; - const auto* buf4 = results4[dd12]; - const auto* buf2 = results2[d12]; - - // this iterates over integrals in the order they are packed in - // array - // ints_shellset - for (auto f1 = 0, f12 = 0; f1 != n1; ++f1) - for (auto f2 = 0; f2 != n2; ++f2, ++f12) - assert(std::abs(buf4[f12] - buf2[f12]) < 1e-12 && - "2nd deriv 2-center ints test failed"); - } - } - } - } - } -#endif - -} From f3ddba19d98723ea224c6354294b6d3f3ec741b9 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 4 Feb 2022 16:02:39 -0500 Subject: [PATCH 119/182] ci 59 --- lib/basis/6-31G_d_.g94 | 804 ---------------------------------- src/bin/libint/CMakeLists.txt | 4 +- src/bin/libint/comp_xyz.cc | 3 + 3 files changed, 5 insertions(+), 806 deletions(-) delete mode 100644 lib/basis/6-31G_d_.g94 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 ffb0b896f..4977349a4 100644 --- a/src/bin/libint/CMakeLists.txt +++ b/src/bin/libint/CMakeLists.txt @@ -79,8 +79,8 @@ endif() add_executable(build_libint EXCLUDE_FROM_ALL build_libint.cc) target_link_libraries(build_libint libint-libcompiler) if(MSVC) - # Increase stack size from 1 MB to 4 MB - set_target_properties(build_libint PROPERTIES LINK_FLAGS "/STACK:4194304") + # Increase stack size from 1 MB to 8 MB + set_target_properties(build_libint PROPERTIES LINK_FLAGS "/STACK:8388608") endif() set_target_properties(build_libint diff --git a/src/bin/libint/comp_xyz.cc b/src/bin/libint/comp_xyz.cc index 9e7f87be9..c31a9fe8d 100644 --- a/src/bin/libint/comp_xyz.cc +++ b/src/bin/libint/comp_xyz.cc @@ -176,16 +176,19 @@ void CR_XYZ_1_1,KineticOper,EmptySet>::compute(con auto am1bp1 = factory.make_child(am1,bp1); \ expr_ -= Scalar(0.5 * a[0]) * Scalar("two_alpha0_ket") * am1bp1; \ nflops_ += 3; \ + printf("Exists am1 %d\n", nflops_); \ } \ if (exists(bm1)) { \ auto ap1bm1 = factory.make_child(ap1,bm1); \ expr_ -= Scalar(0.5 * b[0]) * Scalar("two_alpha0_bra") * ap1bm1; \ nflops_ += 3; \ + printf("Exists bm1 %d\n", nflops_); \ } \ if (exists(am1) && exists(bm1)) { \ auto am1bm1 = factory.make_child(am1,bm1); \ expr_ += Scalar(0.5 * a[0] * b[0]) * am1bm1; \ nflops_ += 2; \ + printf("Exists am1 & bm1 %d\n", nflops_); \ } \ } From 75797b4dd0d9c1957a369f9af1a42d1add79e4ad Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Mon, 7 Feb 2022 18:54:18 -0500 Subject: [PATCH 120/182] correct desparate edits --- CMakeLists.txt | 3 +-- src/bin/libint/comp_xyz.cc | 3 --- src/lib/libint/CMakeLists.txt | 6 ++---- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bc447521..dcd560cdd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,8 +267,7 @@ include(CheckFunctionExists) include(int_orderings) include(int_am) -#check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN) -set(HAVE_POSIX_MEMALIGN 1) +check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN) if (HAVE_POSIX_MEMALIGN) set(LIBINT2_ALIGN_SIZE "0" CACHE STRING "(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") endif() diff --git a/src/bin/libint/comp_xyz.cc b/src/bin/libint/comp_xyz.cc index c31a9fe8d..9e7f87be9 100644 --- a/src/bin/libint/comp_xyz.cc +++ b/src/bin/libint/comp_xyz.cc @@ -176,19 +176,16 @@ void CR_XYZ_1_1,KineticOper,EmptySet>::compute(con auto am1bp1 = factory.make_child(am1,bp1); \ expr_ -= Scalar(0.5 * a[0]) * Scalar("two_alpha0_ket") * am1bp1; \ nflops_ += 3; \ - printf("Exists am1 %d\n", nflops_); \ } \ if (exists(bm1)) { \ auto ap1bm1 = factory.make_child(ap1,bm1); \ expr_ -= Scalar(0.5 * b[0]) * Scalar("two_alpha0_bra") * ap1bm1; \ nflops_ += 3; \ - printf("Exists bm1 %d\n", nflops_); \ } \ if (exists(am1) && exists(bm1)) { \ auto am1bm1 = factory.make_child(am1,bm1); \ expr_ += Scalar(0.5 * a[0] * b[0]) * am1bm1; \ nflops_ += 2; \ - printf("Exists am1 & bm1 %d\n", nflops_); \ } \ } diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index 8c3c52593..abd8e8be0 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -40,10 +40,8 @@ add_custom_command(OUTPUT "${EXPORT_STAGE_DIR}.tgz" 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}") + add_custom_target(libint-library-export DEPENDS "${EXPORT_STAGE_DIR}.tgz" + COMMAND ${CMAKE_COMMAND} -S "${CMAKE_SOURCE_DIR}" -B "${CMAKE_BINARY_DIR}") else() add_custom_target(libint-library-export DEPENDS "${EXPORT_STAGE_DIR}.tgz") endif() From 9709f7faf07af89b5b58d8b226e09f5d30a7e6b4 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Mon, 7 Feb 2022 18:54:48 -0500 Subject: [PATCH 121/182] bump version even with master --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dcd560cdd..930a2a69d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_policy(SET CMP0074 NEW) project( Libint2Compiler - VERSION 2.7.0 + VERSION 2.7.1 DESCRIPTION "High-performance library for computing Gaussian integrals in quantum mechanics" HOMEPAGE_URL "https://github.com/evaleev/libint" LANGUAGES CXX @@ -15,7 +15,7 @@ set(${PROJECT_NAME}_AUTHORS "Edward F. Valeev") set(${PROJECT_NAME}_LICENSE "GPL-3.0 for generator; LGPL-3.0 for generated") # along with project(... VERSION) above, these are the authoritative version source (formerly in configure.ac) -set(LIBINT_BUILDID "beta.6") +set(LIBINT_BUILDID "") set(LIBINT_SOVERSION "2:3:0") list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) From 8b44d3eea7938b4a7e8139d04eb063f7313b50de Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 8 Feb 2022 02:02:16 -0500 Subject: [PATCH 122/182] add t1g12 option --- CMakeLists.txt | 3 +++ INSTALL.md | 3 +++ cmake/modules/int_am.cmake | 7 +++++++ include/libint2/config.h.cmake.in | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 930a2a69d..2b1a46c02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,6 +99,8 @@ 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 >>> @@ -302,6 +304,7 @@ 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}) diff --git a/INSTALL.md b/INSTALL.md index e44df3757..d0ccb35c9 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -147,6 +147,9 @@ These are the most useful configure options: * `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 Convention * `LIBINT2_SHGAUSS_ORDERING` — L — Ordering for shells of solid harmonic Gaussians. Consumed at library build-time. [Default=standard] diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index 7959d9a3d..9f4ae3363 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -242,6 +242,13 @@ process_integrals_class(ERI2) 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 class + deriv + max_am strings to use in Libint2Config set(Libint2_ERI_COMPONENTS "") foreach(_cls ERI;ERI3;ERI2;ONEBODY) diff --git a/include/libint2/config.h.cmake.in b/include/libint2/config.h.cmake.in index 95400f313..75b6a41cf 100644 --- a/include/libint2/config.h.cmake.in +++ b/include/libint2/config.h.cmake.in @@ -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@ From f68fd0d8b878b36822bc85861f8810a3feccf8f6 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 8 Feb 2022 02:07:47 -0500 Subject: [PATCH 123/182] enable g12 --- INSTALL.md | 17 +++++++ cmake/modules/int_am.cmake | 92 +++++++++++++++++++++++++++++++++++--- 2 files changed, 104 insertions(+), 5 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index d0ccb35c9..bf93ffad3 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -208,6 +208,13 @@ These are the most useful configure options: * `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`] + + ### Miscellaneous * Notes @@ -267,6 +274,16 @@ These are the most useful configure options: * `--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` diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index 9f4ae3363..c3a1120c7 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -233,14 +233,92 @@ macro(process_integrals_class class) 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}_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_pre} (else ${LIBINT_OPT_AM})") + endif() +endmacro() + + process_integrals_class(ONEBODY) process_integrals_class(ERI) process_integrals_class(ERI3) process_integrals_class(ERI2) - -# discrepancy, as configure doesn't do AM_LIST for these -process_integrals_class(G12) -process_integrals_class(G12DKH) +# 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) if (ENABLE_G12 GREATER_EQUAL 0) set(SUPPORT_T1G12 ${ENABLE_T1G12_SUPPORT}) @@ -251,7 +329,7 @@ endif() # form list of active class + deriv + max_am strings to use in Libint2Config set(Libint2_ERI_COMPONENTS "") -foreach(_cls ERI;ERI3;ERI2;ONEBODY) +foreach(_cls ERI;ERI3;ERI2;ONEBODY;G12;G12DKH) if (_cls STREQUAL "ERI") set(_lbl "eri_c4") elseif (_cls STREQUAL "ERI3") @@ -260,6 +338,10 @@ foreach(_cls ERI;ERI3;ERI2;ONEBODY) 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() if (INCLUDE_${_cls} GREATER -1) From bd7eac04108931c2fd870fd21d4b98200ae1b7fd Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 8 Feb 2022 02:45:47 -0500 Subject: [PATCH 124/182] ci 60 --- .github/workflows/cmake.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index f2c53fd18..4db50c617 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -201,7 +201,9 @@ jobs: cat CMakeLists.txt cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" cmake --build build --target hf++ - ./build/hf++ ../src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ../src/lib/libint/tests/hartree-fock/hartree-fock++-validate.py ../build/libint-2*/features + if [[ ${{ runner.os }} == "Windows" ]]; then + ./build/hf++ ../src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ../src/lib/libint/tests/hartree-fock/hartree-fock++-validate.py ../build/libint-2*/features + fi # Notes: # * Windows with CMAKE_BUILD_TYPE=Debug gives errors like: From 394fe0c27c66c5d6332fb6493cbb88c21ff98f71 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 8 Feb 2022 03:02:11 -0500 Subject: [PATCH 125/182] ci 61 --- .github/workflows/cmake.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4db50c617..1f0391607 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -201,11 +201,13 @@ jobs: cat CMakeLists.txt cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" cmake --build build --target hf++ - if [[ ${{ runner.os }} == "Windows" ]]; then + if [[ "${{ runner.os }}" != "Windows" ]]; then ./build/hf++ ../src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ../src/lib/libint/tests/hartree-fock/hartree-fock++-validate.py ../build/libint-2*/features fi # Notes: +# * Windows with Release and ExternalProject compiles just fine, but its SCF answer is -1115 E_h. See https://github.com/evaleev/libint/issues/235 +# # * Windows with CMAKE_BUILD_TYPE=Debug gives errors like: # ``` # In file included from D:\a\libint\libint\installed\include\libint2/diis.h:368: From 116e1cdecb7e01d66b7ccfcfd370a1055f961dd5 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 8 Feb 2022 14:44:52 -0500 Subject: [PATCH 126/182] ci 62 --- .github/workflows/cmake.yml | 48 +++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 1f0391607..22ff59471 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -8,11 +8,7 @@ jobs: fail-fast: false matrix: cfg: - #- runs-on: ubuntu-20.04 - # build_type: Release - # cxx: g++-9 - - - runs-on: ubuntu-20.04 + - runs-on: ubuntu-latest build_type: Release cxx: g++-9 cc: gcc-9 @@ -20,9 +16,23 @@ jobs: args: > -DENABLE_FORTRAN=ON - #- runs-on: macos-latest - # build_type: Release - # cxx: clang++ + - 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 #- runs-on: macos-latest # build_type: Debug @@ -37,13 +47,6 @@ jobs: # -DPYBIND11_FINDPYTHON=ON # -DCMAKE_CXX_FLAGS="-D_=1" - - runs-on: windows-2022 - build_type: Release - cxx: clang-cl - cc: clang-cl - args: "" #> - #-DCMAKE_C_COMPILER=clang-cl - # -DCMAKE_CXX_FLAGS="-D_=1" #cxx: /usr/bin/g++-9 @@ -94,14 +97,14 @@ jobs: cmake -E make_directory ${{github.workspace}}/test_installed_library cmake -E make_directory ${{github.workspace}}/installed - - name: Install prerequisite MacOS packages + - name: Install MacOS prerequisites if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'macOS' }} run: | brew install ninja gcc@10 boost eigen ccache #echo "FC=/usr/local/bin/gfortran-10" >> $GITHUB_ENV #echo "EIGEN3_INCLUDE_DIR=/usr/local/include/eigen3" >> $GITHUB_ENV - - name: Install prerequisites Ubuntu packages + - name: Install Ubuntu prerequisites if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Linux' }} run: | sudo apt-get update @@ -153,16 +156,14 @@ jobs: restore-keys: | ${{ matrix.config.name }}-ccache- - - name: Generate+build Libint library (ExternalProject, cplr tests) + - 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=${{ matrix.cfg.build_type }} $BUILD_CONFIG ${{ matrix.cfg.args }} - cmake --build build --target library install + cmake --build build --target library check-libint2compiler install cd build && echo "ARTIFACT=`ls -1 libint*tgz`" >> $GITHUB_ENV - #cmake --build build --target library check-libint2compiler install - #cmake --build build --target library check install - name: Generate+build Libint library (FetchContent, full tests) if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.cfg.build_type == 'Debug'}} @@ -204,9 +205,10 @@ jobs: if [[ "${{ runner.os }}" != "Windows" ]]; then ./build/hf++ ../src/lib/libint/tests/hartree-fock/h2o_rotated.xyz | python ../src/lib/libint/tests/hartree-fock/hartree-fock++-validate.py ../build/libint-2*/features fi + # above is xfail for Windows. SCF is wrong (see below), but we ensure that L2@Win builds, exports, packages ok. -# Notes: -# * Windows with Release and ExternalProject compiles just fine, but its SCF answer is -1115 E_h. See https://github.com/evaleev/libint/issues/235 +# Notes on Windows: +# * Windows with Release and ExternalProject compiles just fine, but its hf++ SCF answer is -1115 E_h. See https://github.com/evaleev/libint/issues/235 # # * Windows with CMAKE_BUILD_TYPE=Debug gives errors like: # ``` From 1207ed7f7b7b475d64d9852386073ac421a5e245 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 8 Feb 2022 17:54:35 -0500 Subject: [PATCH 127/182] ci 63 --- .github/workflows/cmake.yml | 68 ++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 22ff59471..533efe6f4 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -3,7 +3,7 @@ name: CI on: [push, pull_request] jobs: - build: + build_repo: strategy: fail-fast: false matrix: @@ -47,10 +47,6 @@ jobs: # -DPYBIND11_FINDPYTHON=ON # -DCMAKE_CXX_FLAGS="-D_=1" - # -DCMAKE_CXX_FLAGS="-D_=1" - - #cxx: /usr/bin/g++-9 - #-DCMAKE_PREFIX_PATH=/usr/local/Cellar/eigen/3.3.9 name: "${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.cxx }} • ${{ matrix.cfg.build_type }} • ${{ matrix.cfg.args }}" @@ -222,3 +218,65 @@ jobs: # This is known issue https://gitlab.kitware.com/cmake/cmake/-/issues/20274 # that should be ok with CMake 3.20+ and Ninja 1.10.2+ (which we have) but broken c. Feb 2022 # + + build_export: + needs: build_repo + strategy: + fail-fast: false + matrix: + cfg: + - runs-on: ubuntu-latest + build_type: Release + args: > + -DBUILD_SHARED_LIBS=ON + + name: "${{ matrix.cfg.runs-on }} • • • ${{ matrix.cfg.args }}" + runs-on: ${{ matrix.cfg.runs-on }} + + steps: + + # saves cloning the repo just for this file + - name: Write a Conda Env File + shell: bash -l {0} + run: | + cat > export.yaml <=3.16 + - ninja + - cxx-compiler + - python + - boost + - eigen + EOF + cat export.yaml + + - name: Create Conda Environment + uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: test + auto-activate-base: false + channels: conda-forge + environment-file: export.yaml + show-channel-urls: true + + - name: Environment Information + run: | + conda info + conda list + which conda python cmake $CXX + + - uses: actions/download-artifact@master + with: + name: Linux-g++-9 + + - name: Test installed Libint library + shell: bash -l {0} + run: | + ls + unzip Linux*zip + tar -zxf libint*tgz + ls + From 4470c092e12466c2c8e61d1c275c08a1566b72e8 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 8 Feb 2022 19:04:24 -0500 Subject: [PATCH 128/182] ci 64 --- .github/workflows/cmake.yml | 101 ++++++++++++++++++++++-------------- 1 file changed, 62 insertions(+), 39 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 533efe6f4..be307af4a 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -16,19 +16,19 @@ jobs: 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: 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 @@ -181,27 +181,27 @@ jobs: path: build/${{ env.ARTIFACT }} retention-days: 1 - - name: Test installed Libint library - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} - shell: bash -l {0} - working-directory: ${{github.workspace}}/test_installed_library - run: | - cat > CMakeLists.txt < CMakeLists.txt < CMakeLists.txt < Date: Tue, 8 Feb 2022 20:42:17 -0500 Subject: [PATCH 129/182] ci 65 --- .github/workflows/cmake.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index be307af4a..13921f087 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -276,6 +276,9 @@ jobs: run: | ls -l tar -zxf libint*tgz + mkdir libint + mv libint-2*/* libint/ + cd libint/ ls -l cmake \ -S. \ @@ -296,10 +299,10 @@ jobs: cmake_minimum_required(VERSION 3.18) project(hf++) find_package(Libint2 REQUIRED COMPONENTS eri_c4_d0_l2 CXX_ho) - add_executable(hf++ "../tests/hartree-fock/hartree-fock++.cc") + add_executable(hf++ "../libint/tests/hartree-fock/hartree-fock++.cc") target_link_libraries(hf++ Libint2::cxx) EOF cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLibint2_DIR="${{github.workspace}}/installed" -DCMAKE_PREFIX_PATH="${CONDA_PREFIX}" cmake --build build --target hf++ - ./build/hf++ ../tests/hartree-fock/h2o_rotated.xyz | python ../tests/hartree-fock/hartree-fock++-validate.py ../build/libint-2*/features + ./build/hf++ ../libint/tests/hartree-fock/h2o_rotated.xyz | python ../libint/tests/hartree-fock/hartree-fock++-validate.py ../libint/build/libint-2*/features From d0cc5866b3feb3c14e1e2a49f94e78b76cd76488 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 8 Feb 2022 21:09:57 -0500 Subject: [PATCH 130/182] ci 66 --- .github/workflows/cmake.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 13921f087..d7330074d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -274,18 +274,14 @@ jobs: - name: Extract, Build, Install Libint Library shell: bash -l {0} run: | - ls -l tar -zxf libint*tgz - mkdir libint - mv libint-2*/* libint/ - cd libint/ - ls -l + mkdir libint && mv libint-2*/* libint/ && cd libint/ cmake \ -S. \ -Bbuild \ -G"Ninja" \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/installed + -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/installed \ -DCMAKE_CXX_COMPILER=${CXX} \ -DCMAKE_PREFIX_PATH="${CONDA_PREFIX}" \ ${{ matrix.cfg.args }} From 7938b6b1e2ea95e9344d955c862254cf0b4901d3 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 8 Feb 2022 21:30:59 -0500 Subject: [PATCH 131/182] ci 67 --- .github/workflows/cmake.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d7330074d..12547acdb 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -158,7 +158,7 @@ jobs: working-directory: ${{github.workspace}} run: | cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.cfg.build_type }} $BUILD_CONFIG ${{ matrix.cfg.args }} - cmake --build build --target library check-libint2compiler install + cmake --build build --target export #library check-libint2compiler install cd build && echo "ARTIFACT=`ls -1 libint*tgz`" >> $GITHUB_ENV - name: Generate+build Libint library (FetchContent, full tests) @@ -298,7 +298,7 @@ jobs: add_executable(hf++ "../libint/tests/hartree-fock/hartree-fock++.cc") target_link_libraries(hf++ Libint2::cxx) EOF - cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLibint2_DIR="${{github.workspace}}/installed" -DCMAKE_PREFIX_PATH="${CONDA_PREFIX}" + cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed:${CONDA_PREFIX}" cmake --build build --target hf++ ./build/hf++ ../libint/tests/hartree-fock/h2o_rotated.xyz | python ../libint/tests/hartree-fock/hartree-fock++-validate.py ../libint/build/libint-2*/features From 9dd660cf2aaf87dd973806185568086759043d6f Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 8 Feb 2022 21:45:32 -0500 Subject: [PATCH 132/182] ci 68 --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 12547acdb..faaf6aeb3 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -298,7 +298,7 @@ jobs: add_executable(hf++ "../libint/tests/hartree-fock/hartree-fock++.cc") target_link_libraries(hf++ Libint2::cxx) EOF - cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed:${CONDA_PREFIX}" + cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed;${CONDA_PREFIX}" cmake --build build --target hf++ ./build/hf++ ../libint/tests/hartree-fock/h2o_rotated.xyz | python ../libint/tests/hartree-fock/hartree-fock++-validate.py ../libint/build/libint-2*/features From 3785a52bce0dbbf430e6c8e57230adc9eca178dc Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 8 Feb 2022 22:01:41 -0500 Subject: [PATCH 133/182] ci 69 --- .github/workflows/cmake.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index faaf6aeb3..3cab1699b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -295,8 +295,9 @@ jobs: cmake_minimum_required(VERSION 3.18) project(hf++) find_package(Libint2 REQUIRED COMPONENTS eri_c4_d0_l2 CXX_ho) + find_package(Threads) # clang does not autolink threads even though we are using std::thread add_executable(hf++ "../libint/tests/hartree-fock/hartree-fock++.cc") - target_link_libraries(hf++ Libint2::cxx) + target_link_libraries(hf++ Libint2::cxx Threads::Threads) EOF cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed;${CONDA_PREFIX}" cmake --build build --target hf++ From 5e0e093ea284988a6828a67898f2c675b4007866 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 8 Feb 2022 22:43:50 -0500 Subject: [PATCH 134/182] ci 70 --- .github/workflows/cmake.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 3cab1699b..f758e691d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -296,10 +296,12 @@ jobs: project(hf++) find_package(Libint2 REQUIRED COMPONENTS eri_c4_d0_l2 CXX_ho) find_package(Threads) # clang does not autolink threads even though we are using std::thread - add_executable(hf++ "../libint/tests/hartree-fock/hartree-fock++.cc") + add_executable(hf++ EXCLUDE_FROM_ALL "../libint/tests/hartree-fock/hartree-fock++.cc") target_link_libraries(hf++ Libint2::cxx Threads::Threads) EOF cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed;${CONDA_PREFIX}" cmake --build build --target hf++ - ./build/hf++ ../libint/tests/hartree-fock/h2o_rotated.xyz | python ../libint/tests/hartree-fock/hartree-fock++-validate.py ../libint/build/libint-2*/features + ls -l ../libint/ + ls -l ../libint/tests/hartree-fock/ + ./build/hf++ ../libint/tests/hartree-fock/h2o_rotated.xyz | python ../libint/tests/hartree-fock/hartree-fock++-validate.py ../libint/features From 7fb01187504fdff988ede25233acf32b8976ece2 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 8 Feb 2022 23:02:30 -0500 Subject: [PATCH 135/182] ci 71 --- .github/workflows/cmake.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index f758e691d..d52f6ac13 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -49,7 +49,7 @@ jobs: #-DCMAKE_PREFIX_PATH=/usr/local/Cellar/eigen/3.3.9 - name: "${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.cxx }} • ${{ matrix.cfg.build_type }} • ${{ matrix.cfg.args }}" + 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.cfg.cxx }} @@ -226,16 +226,24 @@ jobs: matrix: cfg: - runs-on: ubuntu-latest - build_type: Release args: > -DBUILD_SHARED_LIBS=ON + -DCMAKE_BUILD_TYPE=Release + + - runs-on: macos-latest + args: > + -DBUILD_SHARED_LIBS=ON + -DCMAKE_BUILD_TYPE=Release - name: "${{ matrix.cfg.runs-on }} • • • ${{ matrix.cfg.args }}" + - runs-on: windows-latest + args: > + -DBUILD_SHARED_LIBS=ON + -DCMAKE_BUILD_TYPE=Release + + name: "Export • ${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.args }}" runs-on: ${{ matrix.cfg.runs-on }} steps: - - # saves cloning the repo just for this file - name: Write a Conda Env File shell: bash -l {0} run: | @@ -301,7 +309,5 @@ jobs: EOF cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed;${CONDA_PREFIX}" cmake --build build --target hf++ - ls -l ../libint/ - ls -l ../libint/tests/hartree-fock/ ./build/hf++ ../libint/tests/hartree-fock/h2o_rotated.xyz | python ../libint/tests/hartree-fock/hartree-fock++-validate.py ../libint/features From 32d83e83fcbe59cdaa93699df30a5b90ded7da26 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 00:01:47 -0500 Subject: [PATCH 136/182] ci 72 --- .github/workflows/cmake.yml | 1 + src/lib/libint/CMakeLists.txt.export | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d52f6ac13..0ba9de7da 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -270,6 +270,7 @@ jobs: show-channel-urls: true - name: Environment Information + shell: bash -l {0} run: | conda info conda list diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 70bd1fc5f..1e327f083 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -228,11 +228,14 @@ 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(BUILD_SHARED_LIBS 1) + set_target_properties(int-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) + if (APPLE) + set_target_properties(int-obj PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + endif() 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 lib needed for non-header-only version @@ -250,6 +253,10 @@ if (REQUIRE_CXX_API AND NOT MSVC) if (BUILD_SHARED_LIBS) set_target_properties(int-cxx-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) + + if (APPLE) + set_target_properties(int-cxx-obj PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + endif() endif() target_include_directories( From 7d7b2c79b6177c75ddf09f0cbc79875771e6c91b Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 00:32:03 -0500 Subject: [PATCH 137/182] ci 73 --- .github/workflows/cmake.yml | 18 ++++++++++++------ src/lib/libint/CMakeLists.txt.export | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 0ba9de7da..f7b5f9887 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -269,12 +269,18 @@ jobs: environment-file: export.yaml show-channel-urls: true - - name: Environment Information - shell: bash -l {0} - run: | - conda info - conda list - which conda python cmake $CXX +# - name: Environment Information +# shell: bash -l {0} +# run: | +# conda info +# conda list +# which python cmake $CXX + + - 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: diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 1e327f083..1928ad386 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -294,6 +294,13 @@ if (BUILD_SHARED_LIBS) OUTPUT_NAME "int2" EXPORT_NAME "int2" ) + if (APPLE) + set_target_properties( + int-shared + PROPERTIES + LINK_FLAGS "-undefined dynamic_lookup" + ) + endif() target_include_directories( int-shared @@ -336,6 +343,13 @@ if (BUILD_SHARED_LIBS) OUTPUT_NAME "int2-cxx" EXPORT_NAME "int2-cxx" ) + if (APPLE) + set_target_properties( + int-cxx-shared + PROPERTIES + LINK_FLAGS "-undefined dynamic_lookup" + ) + endif() target_link_libraries(int-cxx-shared INTERFACE int-cxx-headeronly-shared) endif() From 932cd95ffc5cbed9f63716800b1348e88f59ee55 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 01:44:35 -0500 Subject: [PATCH 138/182] ci 74 --- .github/workflows/cmake.yml | 3 +++ src/lib/libint/CMakeLists.txt.export | 7 ------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index f7b5f9887..d94d57564 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -239,6 +239,7 @@ jobs: args: > -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release + -DCMAKE_CXX_COMPILER=clang-cl name: "Export • ${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.args }}" runs-on: ${{ matrix.cfg.runs-on }} @@ -268,6 +269,8 @@ jobs: channels: conda-forge environment-file: export.yaml show-channel-urls: true + conda-build-version: "*" + show-channel-urls: true # - name: Environment Information # shell: bash -l {0} diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 1928ad386..db20ec05d 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -230,9 +230,6 @@ target_include_directories(int-obj PRIVATE ${PROJECT_BINARY_DIR}/include/ if(BUILD_SHARED_LIBS OR LIBINT2_BUILD_SHARED_AND_STATIC_LIBS) set(BUILD_SHARED_LIBS 1) set_target_properties(int-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) - if (APPLE) - set_target_properties(int-obj PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") - endif() endif() if (NOT BUILD_SHARED_LIBS OR LIBINT2_BUILD_SHARED_AND_STATIC_LIBS) set(BUILD_STATIC_LIBS 1) @@ -253,10 +250,6 @@ if (REQUIRE_CXX_API AND NOT MSVC) if (BUILD_SHARED_LIBS) set_target_properties(int-cxx-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) - - if (APPLE) - set_target_properties(int-cxx-obj PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") - endif() endif() target_include_directories( From a6d6cc8b973ba34977a39ad87ed4528f2f1f054f Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 02:04:46 -0500 Subject: [PATCH 139/182] ci 75 --- .github/workflows/cmake.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d94d57564..dfb5ff9b7 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -265,12 +265,11 @@ jobs: uses: conda-incubator/setup-miniconda@v2 with: activate-environment: test - auto-activate-base: false + auto-activate-base: true channels: conda-forge environment-file: export.yaml show-channel-urls: true conda-build-version: "*" - show-channel-urls: true # - name: Environment Information # shell: bash -l {0} From c3d7e28feff801845195a929ab7db5e59cb7d67b Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 02:21:26 -0500 Subject: [PATCH 140/182] ci 76 --- .github/workflows/cmake.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index dfb5ff9b7..4707891e6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -246,6 +246,7 @@ jobs: steps: - name: Write a Conda Env File + if: ${{ runner.os != 'Windows' }} shell: bash -l {0} run: | cat > export.yaml < export.yaml <=3.16 + - ninja + - python + - boost + - eigen + EOF + - name: Create Conda Environment uses: conda-incubator/setup-miniconda@v2 with: - activate-environment: test + activate-environment: "" auto-activate-base: true channels: conda-forge environment-file: export.yaml From fb51a5734569be0ff1419c24a4320893eeabb455 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 02:38:33 -0500 Subject: [PATCH 141/182] ci 77 --- .github/workflows/cmake.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4707891e6..2001a1efe 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -281,18 +281,16 @@ jobs: - name: Create Conda Environment uses: conda-incubator/setup-miniconda@v2 with: - activate-environment: "" - auto-activate-base: true + activate-environment: test channels: conda-forge environment-file: export.yaml show-channel-urls: true - conda-build-version: "*" -# - name: Environment Information -# shell: bash -l {0} -# run: | -# conda info -# conda list + - name: Environment Information + shell: bash -l {0} + run: | + conda info + conda list # which python cmake $CXX - name: Prepare compiler environment for Windows From 3961e040f6621c8cd50c949c621638bc6744485a Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 02:57:02 -0500 Subject: [PATCH 142/182] ci 78 --- .github/workflows/cmake.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2001a1efe..5e1c7371b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -291,7 +291,6 @@ jobs: run: | conda info conda list -# which python cmake $CXX - name: Prepare compiler environment for Windows if: ${{ runner.os == 'Windows' }} @@ -331,7 +330,7 @@ jobs: add_executable(hf++ EXCLUDE_FROM_ALL "../libint/tests/hartree-fock/hartree-fock++.cc") target_link_libraries(hf++ Libint2::cxx Threads::Threads) EOF - cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed;${CONDA_PREFIX}" + cmake -S . -B build -G Ninja ${{ matrix.cfg.args }} -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed;${CONDA_PREFIX}" cmake --build build --target hf++ ./build/hf++ ../libint/tests/hartree-fock/h2o_rotated.xyz | python ../libint/tests/hartree-fock/hartree-fock++-validate.py ../libint/features From f2a1066e791c35ef59578f1514f6dcfeca912416 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 03:15:43 -0500 Subject: [PATCH 143/182] ci 79 --- .github/workflows/cmake.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 5e1c7371b..1a9b2f08f 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -240,6 +240,7 @@ jobs: -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang-cl + -DCMAKE_C_COMPILER=clang-cl name: "Export • ${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.args }}" runs-on: ${{ matrix.cfg.runs-on }} @@ -330,7 +331,7 @@ jobs: add_executable(hf++ EXCLUDE_FROM_ALL "../libint/tests/hartree-fock/hartree-fock++.cc") target_link_libraries(hf++ Libint2::cxx Threads::Threads) EOF - cmake -S . -B build -G Ninja ${{ matrix.cfg.args }} -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed;${CONDA_PREFIX}" + cmake -S . -B build -G Ninja -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed;${CONDA_PREFIX}" ${{ matrix.cfg.args }} cmake --build build --target hf++ ./build/hf++ ../libint/tests/hartree-fock/h2o_rotated.xyz | python ../libint/tests/hartree-fock/hartree-fock++-validate.py ../libint/features From 0d75fc4c54a8fa33701bad14658147c7eaf5bc5d Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 03:38:10 -0500 Subject: [PATCH 144/182] ci 80 --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 1a9b2f08f..d5dfd234a 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -331,7 +331,7 @@ jobs: add_executable(hf++ EXCLUDE_FROM_ALL "../libint/tests/hartree-fock/hartree-fock++.cc") target_link_libraries(hf++ Libint2::cxx Threads::Threads) EOF - cmake -S . -B build -G Ninja -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed;${CONDA_PREFIX}" ${{ matrix.cfg.args }} + cmake -S . -B build -G Ninja -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" ${{ matrix.cfg.args }} cmake --build build --target hf++ ./build/hf++ ../libint/tests/hartree-fock/h2o_rotated.xyz | python ../libint/tests/hartree-fock/hartree-fock++-validate.py ../libint/features From 79297a80696d72705eff609bc89e2eb02ea407d4 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 09:19:04 -0500 Subject: [PATCH 145/182] ci 81 --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d5dfd234a..67af88f66 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -313,7 +313,7 @@ jobs: -Bbuild \ -G"Ninja" \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/installed \ + -DCMAKE_INSTALL_PREFIX="${{github.workspace}}/installed" \ -DCMAKE_CXX_COMPILER=${CXX} \ -DCMAKE_PREFIX_PATH="${CONDA_PREFIX}" \ ${{ matrix.cfg.args }} From bbfb0c2ed882022bc7f19794b88d0fd233e7d18f Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 09:45:19 -0500 Subject: [PATCH 146/182] ci 82 --- .github/workflows/cmake.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 67af88f66..4617148ce 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -152,16 +152,17 @@ jobs: restore-keys: | ${{ matrix.config.name }}-ccache- - - name: Generate + build Libint library (ExternalProject, cplr tests) + - 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=${{ matrix.cfg.build_type }} $BUILD_CONFIG ${{ matrix.cfg.args }} - cmake --build build --target export #library check-libint2compiler install + 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, full tests) + - 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}} @@ -241,6 +242,7 @@ jobs: -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl + -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON name: "Export • ${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.args }}" runs-on: ${{ matrix.cfg.runs-on }} @@ -319,7 +321,7 @@ jobs: ${{ matrix.cfg.args }} cmake --build build --target install - - name: Test installed Libint library + - name: Test Installed Libint library shell: bash -l {0} run: | mkdir test_installed_library && cd test_installed_library From c148b953e93c9cefeaf7116c3d54f30258f4cb85 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 12:00:13 -0500 Subject: [PATCH 147/182] ci 83 --- .github/workflows/cmake.yml | 3 ++- src/lib/libint/CMakeLists.txt.export | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4617148ce..c22b4a1f6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -243,6 +243,7 @@ jobs: -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON + -DCMAKE_CXX_FLAGS="/wd4018 /wd4101 /wd4996" name: "Export • ${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.args }}" runs-on: ${{ matrix.cfg.runs-on }} @@ -331,7 +332,7 @@ jobs: find_package(Libint2 REQUIRED COMPONENTS eri_c4_d0_l2 CXX_ho) find_package(Threads) # clang does not autolink threads even though we are using std::thread add_executable(hf++ EXCLUDE_FROM_ALL "../libint/tests/hartree-fock/hartree-fock++.cc") - target_link_libraries(hf++ Libint2::cxx Threads::Threads) + target_link_libraries(hf++ Libint2::cxx Libint2::int2 Threads::Threads) EOF cmake -S . -B build -G Ninja -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" ${{ matrix.cfg.args }} cmake --build build --target hf++ diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index db20ec05d..0a51185e9 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -294,6 +294,13 @@ if (BUILD_SHARED_LIBS) LINK_FLAGS "-undefined dynamic_lookup" ) endif() + if (MSVC) + set_target_properties( + int-shared + PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS ON + ) + endif() target_include_directories( int-shared @@ -343,6 +350,12 @@ if (BUILD_SHARED_LIBS) LINK_FLAGS "-undefined dynamic_lookup" ) endif() + if (MSVC) + set_target_properties( + int-cxx-shared + PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS ON + ) target_link_libraries(int-cxx-shared INTERFACE int-cxx-headeronly-shared) endif() From 46eb92bee3668e82433b2bc8fef1139e0f8e334d Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 12:11:05 -0500 Subject: [PATCH 148/182] ci 84 --- src/lib/libint/CMakeLists.txt.export | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 0a51185e9..067835218 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -356,6 +356,7 @@ if (BUILD_SHARED_LIBS) PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON ) + endif() target_link_libraries(int-cxx-shared INTERFACE int-cxx-headeronly-shared) endif() From 49441da85115293bea347b104c5a9e7680f848ce Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 12:22:34 -0500 Subject: [PATCH 149/182] ci 85 --- .github/workflows/cmake.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index c22b4a1f6..263870d91 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -220,6 +220,10 @@ jobs: # that should be ok with CMake 3.20+ and Ninja 1.10.2+ (which we have) but broken c. Feb 2022 # + # for efficient debug of `build_export` job, in `build_repo` job above: + # * comment out all but a single Linux/Release in matrix.cfg + # * toggle to "export" target rather than "library" target in EP step + # * comment out the "hf++" step build_export: needs: build_repo strategy: @@ -243,7 +247,6 @@ jobs: -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON - -DCMAKE_CXX_FLAGS="/wd4018 /wd4101 /wd4996" name: "Export • ${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.args }}" runs-on: ${{ matrix.cfg.runs-on }} From a440625ad2a016fa9c97426830919f98a405328c Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 13:13:24 -0500 Subject: [PATCH 150/182] ci 86 --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 263870d91..1794eaef9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -242,7 +242,7 @@ jobs: - runs-on: windows-latest args: > - -DBUILD_SHARED_LIBS=ON + -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl From 824222184bad7090390cd653545620412324955c Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 15:05:01 -0500 Subject: [PATCH 151/182] ci 87 --- .github/workflows/cmake.yml | 67 ++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 1794eaef9..13af933f4 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -246,44 +246,41 @@ jobs: -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl - -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON name: "Export • ${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.args }}" runs-on: ${{ matrix.cfg.runs-on }} steps: - name: Write a Conda Env File - if: ${{ runner.os != 'Windows' }} shell: bash -l {0} run: | - cat > export.yaml <=3.16 - - ninja - - cxx-compiler - - python - - boost - - eigen - EOF - - - name: Write a Conda Env File - if: ${{ runner.os == 'Windows' }} - shell: bash -l {0} - run: | - cat > export.yaml <=3.16 - - ninja - - python - - boost - - eigen - EOF + if [[ "${{ runner.os }}" == "Windows" ]]; then + cat > export.yaml <=3.16 + - ninja + - python + - boost + - eigen + EOF + else + cat > export.yaml <=3.16 + - ninja + - cxx-compiler + - python + - boost + - eigen + EOF + fi + cat export.yaml - name: Create Conda Environment uses: conda-incubator/setup-miniconda@v2 @@ -293,17 +290,17 @@ jobs: environment-file: export.yaml show-channel-urls: true + - name: Confound Environment wrt Boost + if: ${{ runner.os == 'macOS' }} + shell: bash -l {0} + run: conda remove boost + - 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: From cb231157d2f357c1e1c1c0e646d9c10db0da62bb Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 15:18:16 -0500 Subject: [PATCH 152/182] ci 88 --- .github/workflows/cmake.yml | 58 +++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 13af933f4..513542929 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -252,35 +252,37 @@ jobs: steps: - name: Write a Conda Env File + if: ${{ runner.os != 'Windows' }} shell: bash -l {0} run: | - if [[ "${{ runner.os }}" == "Windows" ]]; then - cat > export.yaml <=3.16 - - ninja - - python - - boost - - eigen - EOF - else - cat > export.yaml <=3.16 - - ninja - - cxx-compiler - - python - - boost - - eigen - EOF - fi - cat export.yaml + cat > export.yaml <=3.16 + - ninja + - cxx-compiler + - python + - boost + - eigen + EOF + + - name: Write a Conda Env File + if: ${{ runner.os == 'Windows' }} + shell: bash -l {0} + run: | + cat > export.yaml <=3.16 + - ninja + - python + - boost + - eigen + EOF - name: Create Conda Environment uses: conda-incubator/setup-miniconda@v2 @@ -332,7 +334,7 @@ jobs: find_package(Libint2 REQUIRED COMPONENTS eri_c4_d0_l2 CXX_ho) find_package(Threads) # clang does not autolink threads even though we are using std::thread add_executable(hf++ EXCLUDE_FROM_ALL "../libint/tests/hartree-fock/hartree-fock++.cc") - target_link_libraries(hf++ Libint2::cxx Libint2::int2 Threads::Threads) + target_link_libraries(hf++ Libint2::cxx Threads::Threads) EOF cmake -S . -B build -G Ninja -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" ${{ matrix.cfg.args }} cmake --build build --target hf++ From 960d6ecab9ace04c245b25e4bccd87da0163a9bf Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 15:47:04 -0500 Subject: [PATCH 153/182] ci 89 --- .github/workflows/cmake.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 513542929..810a73365 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -263,7 +263,7 @@ jobs: - cmake >=3.16 - ninja - cxx-compiler - - python + - python 3.9 - boost - eigen EOF @@ -279,7 +279,7 @@ jobs: dependencies: - cmake >=3.16 - ninja - - python + - python 3.9 - boost - eigen EOF @@ -303,6 +303,11 @@ jobs: 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: From 14ad7aea6ecaf08b61844613b628d646e1592ce9 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 9 Feb 2022 17:00:57 -0500 Subject: [PATCH 154/182] ci 90 --- .github/workflows/cmake.yml | 7 +++++++ cmake/libint2-config.cmake.in | 4 ++++ include/libint2/util/cxxstd.h | 11 ++--------- src/lib/libint/CMakeLists.txt.export | 2 ++ 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 810a73365..4a7726b5e 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -292,11 +292,18 @@ jobs: environment-file: export.yaml show-channel-urls: true + # Step is unnecessary. Its presence forces testing bundled Boost - name: Confound Environment wrt Boost if: ${{ runner.os == 'macOS' }} shell: bash -l {0} run: conda remove boost + # Step is unnecessary. + - name: Confound Environment wrt Eigen + if: ${{ runner.os == 'Linux' }} + shell: bash -l {0} + run: rm -rf "${CONDA_PREFIX}/share/eigen3/cmake/" + - name: Environment Information shell: bash -l {0} run: | diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index f0477e976..56188d074 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -125,6 +125,10 @@ if(@REQUIRE_CXX_API@) if (NOT TARGET Boost::headers) find_dependency(Boost 1.57 REQUIRED) endif() + else() + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "-- Boost: satisfied by headers bundled with ${L2} distribution") + endif() endif() set(${L2}_CXX_ho_FOUND 1) diff --git a/include/libint2/util/cxxstd.h b/include/libint2/util/cxxstd.h index 2a9ed545f..c57e4355f 100644 --- a/include/libint2/util/cxxstd.h +++ b/include/libint2/util/cxxstd.h @@ -25,21 +25,14 @@ # error "Libint2 requires a C++ compiler" #endif -#if defined(_MSC_VER) && __cplusplus == 199711L && _MSVC_LANG >= 201402L && _MSC_VER >= 1910 -# define LIBINT2_CPLUSPLUS_STD 2014 // really, 2017 -#elif defined(_MSC_VER) && __cplusplus == 199711L && _MSVC_LANG >= 201402L -# define LIBINT2_CPLUSPLUS_STD 2014 -#elif defined(_MSC_VER) && __cplusplus == 199711L // questionable check -# define LIBINT2_CPLUSPLUS_STD 2011 -#elif __cplusplus >= 201402L +#if __cplusplus >= 201402L # define LIBINT2_CPLUSPLUS_STD 2014 #elif __cplusplus >= 201103L # define LIBINT2_CPLUSPLUS_STD 2011 #elif __cplusplus >= 199711L # define LIBINT2_CPLUSPLUS_STD 1998 #else -# define LIBINT2_CPLUSPLUS_STD 2011 -//# define LIBINT2_CPLUSPLUS_STD 0 // unknown standard +# define LIBINT2_CPLUSPLUS_STD 0 // unknown standard #endif // workaround: standard Intel compiler (not INDE) is not standard conforming diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 067835218..73a6d92f9 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -295,6 +295,7 @@ if (BUILD_SHARED_LIBS) ) endif() if (MSVC) + # necessary but insufficient for dll, https://github.com/evaleev/libint/issues/237 set_target_properties( int-shared PROPERTIES @@ -351,6 +352,7 @@ if (BUILD_SHARED_LIBS) ) endif() if (MSVC) + # necessary but insufficient for dll set_target_properties( int-cxx-shared PROPERTIES From 875ce05eac5606f3ab9562c5be6a424821d3684b Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 10 Feb 2022 17:06:36 -0500 Subject: [PATCH 155/182] ci 91 --- .github/workflows/cmake.yml | 2 + cmake/libint2-config.cmake.in | 9 +- cmake/modules/FindEigen3.cmake | 115 +++++++++++++++++++ cmake/modules/FindTargetEigen3.cmake | 166 --------------------------- src/lib/libint/CMakeLists.txt.export | 16 +-- src/lib/libint/populate.cmake | 2 +- 6 files changed, 131 insertions(+), 179 deletions(-) create mode 100644 cmake/modules/FindEigen3.cmake delete mode 100644 cmake/modules/FindTargetEigen3.cmake diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4a7726b5e..704025c96 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -251,6 +251,8 @@ jobs: 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 if: ${{ runner.os != 'Windows' }} shell: bash -l {0} diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index 56188d074..f429b416b 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -98,7 +98,8 @@ set(L2 Libint2) # NameSpace set(Libint2_EXT_VERSION "@LIBINT_EXT_VERSION@") # make detectable the various cmake modules exported alongside -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) +# * 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@) @@ -116,8 +117,8 @@ include(CMakeFindDependencyMacro) set(${L2}_C_FOUND 1) list(FIND ${L2}_FIND_COMPONENTS "C" _seek_C) if(@REQUIRE_CXX_API@) - if(NOT TARGET tgt::Eigen) - find_dependency(TargetEigen3 REQUIRED) + if(NOT TARGET Eigen3::Eigen) + find_dependency(Eigen3 REQUIRED) endif() if (@LIBINT_HAS_SYSTEM_BOOST_PREPROCESSOR_VARIADICS@) @@ -127,7 +128,7 @@ if(@REQUIRE_CXX_API@) endif() else() if(NOT CMAKE_REQUIRED_QUIET) - message(STATUS "-- Boost: satisfied by headers bundled with ${L2} distribution") + message(STATUS "Boost detected. satisfied by headers bundled with ${L2} distribution") endif() endif() diff --git a/cmake/modules/FindEigen3.cmake b/cmake/modules/FindEigen3.cmake new file mode 100644 index 000000000..46b55d6a0 --- /dev/null +++ b/cmake/modules/FindEigen3.cmake @@ -0,0 +1,115 @@ +# FindEigen3.cmake +# ---------------------- +# +# Eigen3 cmake module to wrap Eigen3 suitable for Libint2. Copied from Eigen v3.4.0 source and modified as follows: +# * +# * +# +# - 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 2) + endif() + if(NOT Eigen3_FIND_VERSION_MINOR) + set(Eigen3_FIND_VERSION_MINOR 91) + 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 (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) + + 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/FindTargetEigen3.cmake b/cmake/modules/FindTargetEigen3.cmake deleted file mode 100644 index 544336dbb..000000000 --- a/cmake/modules/FindTargetEigen3.cmake +++ /dev/null @@ -1,166 +0,0 @@ -# FindTargetEigen3.cmake -# ---------------------- -# -# Eigen3 cmake module to wrap Eigen3 suitable for Libint2, whether Eigen3Config, FindEigen3, or raw variables, in a target. -# -# This module sets the following variables in your project: :: -# -## TargetEigen3_FOUND - true if Eigen3 and all required components found on the system -## TargetEigen3_VERSION - Eigen3 version in format Major.Minor.Release -## TargetEigen3_MESSAGE - status message with Eigen3 library path list and version -## -## Note that components are passed along to find_package(HDF5 (untested) but not checked in the direct TargetHDF5Config -## Note that version checking/attaching not working yet -## -## This module *unsets* the following conventional HDF5 variables so as -## to force using the target: :: -## -## HDF5_FOUND -## HDF5_VERSION -## HDF5_INCLUDE_DIRS -## HDF5_LIBRARIES -## -## Exported targets:: -## -## If Eigen3 is found, this module defines the following :prop_tgt:`IMPORTED` -## target. :: -## -## tgt::Eigen3 - the Eigen3 libraries with headers attached. -## -## Suggested usage:: -## -## find_package(TargetHDF5) -## find_package(TargetHDF5 1.8.16 REQUIRED) -# -# -# The following variables can be set to guide the search for this package:: -# -# TargetEigen3_DIR - CMake variable, set to directory containing this Config file -# CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package - -set(PN TargetEigen3) - -# 1st precedence - libraries passed in through -DHDF5_LIBRARIES -if (HDF5_LIBRARIES AND HDF5_INCLUDE_DIRS) - if (HDF5_VERSION) - if (NOT ${PN}_FIND_QUIETLY) - message (STATUS "HDF5 detection suppressed.") - endif() - - add_library (tgt::hdf5 INTERFACE IMPORTED) - set_property (TARGET tgt::hdf5 PROPERTY INTERFACE_LINK_LIBRARIES ${HDF5_LIBRARIES}) - set_property (TARGET tgt::hdf5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS}) - set (${PN}_VERSION ${HDF5_VERSION}) - else() - message (FATAL_ERROR "Humor the build system - pass in the version, too (for example, -DHDF5_VERSION=1.8.17).") - endif() -else() - # 2nd precedence - target already prepared and findable in TargetEigen3Config.cmake - find_package (TargetEigen3 QUIET CONFIG) - if ((TARGET tgt::Eigen) AND (${PN}_VERSION)) - if (NOT ${PN}_FIND_QUIETLY) - message (STATUS "TargetEigen3Config detected.") - endif() - else() - # 3rd precedence - usual variables from Eigen3Config.cmake - find_package (Eigen3 QUIET CONFIG) - #find_package (Eigen3 MODULE) - if (TARGET Eigen3::Eigen) - if (NOT ${PN}_FIND_QUIETLY) - message (STATUS "Eigen3 detected.") - endif() - - add_library (tgt::Eigen INTERFACE IMPORTED) - - get_property(_iid1 TARGET Eigen3::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES) - set_property (TARGET tgt::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_iid1}) - # set_property (TARGET tgt::eigen PROPERTY INTERFACE_LINK_LIBRARIES ${HDF5_LIBRARIES}) - #set_property (TARGET tgt::hdf5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS}) - set (${PN}_VERSION ${Eigen3_VERSION}) - - #unset (HDF5_FOUND) - #unset (HDF5_VERSION) - #unset (HDF5_LIBRARIES) - #unset (HDF5_INCLUDE_DIRS) - endif() - endif() -endif() - -if (TARGET tgt::Eigen) - get_property(_iid TARGET tgt::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES) - set(${PN}_MESSAGE "Found Eigen3: ${_iid} (found version ${${PN}_VERSION})") -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(${PN} - REQUIRED_VARS ${PN}_MESSAGE - VERSION_VAR ${PN}_VERSION) - -# FindTargetLAPACK.cmake -# ---------------------- -# -# LAPACK cmake module to wrap FindLAPACK.cmake in a target. -# -# This module sets the following variables in your project: :: -# -# TargetLAPACK_FOUND - true if BLAS/LAPACK found on the system -# TargetLAPACK_MESSAGE - status message with BLAS/LAPACK library path list -# -# This module *unsets* the following conventional LAPACK variables so as -# to force using the target: :: -# -# LAPACK_FOUND -# LAPACK_LIBRARIES -# -# In order of decreasing precedence, this module returns in a target ``tgt::lapack`` -# (1) the libraries passed through CMake variable LAPACK_LIBRARIES, -# (2) the libraries defined in a detectable TargetLAPACKConfig.cmake file -# (skip via DISABLE_FIND_PACKAGE_TargetLAPACK), or -# (3) the libraries detected by the usual FindLAPACK.cmake module. -# - -#set(PN TargetLAPACK) -# -## 1st precedence - libraries passed in through -DLAPACK_LIBRARIES -#if (LAPACK_LIBRARIES) -# if (NOT ${PN}_FIND_QUIETLY) -# message (STATUS "LAPACK detection suppressed.") -# endif() -# -# add_library (tgt::lapack INTERFACE IMPORTED) -# set_property (TARGET tgt::lapack PROPERTY INTERFACE_LINK_LIBRARIES ${LAPACK_LIBRARIES}) -#else() -# # 2nd precedence - target already prepared and findable in TargetLAPACKConfig.cmake -# if (NOT "${DISABLE_FIND_PACKAGE_${PN}}") -# find_package (TargetLAPACK QUIET CONFIG) -# endif() -# if (TARGET tgt::lapack) -# if (NOT ${PN}_FIND_QUIETLY) -# message (STATUS "TargetLAPACKConfig detected.") -# endif() -# else() -# # 3rd precedence - usual variables from FindLAPACK.cmake -# find_package (LAPACK QUIET MODULE) -# if (NOT ${PN}_FIND_QUIETLY) -# message (STATUS "LAPACK detected.") -# endif() -# -# add_library (tgt::lapack INTERFACE IMPORTED) -# set_property (TARGET tgt::lapack PROPERTY INTERFACE_LINK_LIBRARIES ${LAPACK_LIBRARIES}) -# -# unset (LAPACK_FOUND) -# unset (LAPACK_LIBRARIES) -# endif() -#endif() -# -#get_property (_ill TARGET tgt::lapack PROPERTY INTERFACE_LINK_LIBRARIES) -#set (${PN}_MESSAGE "Found LAPACK: ${_ill}") -#if ((TARGET tgt::blas) AND (TARGET tgt::lapk)) -# get_property (_illb TARGET tgt::blas PROPERTY INTERFACE_LINK_LIBRARIES) -# get_property (_illl TARGET tgt::lapk PROPERTY INTERFACE_LINK_LIBRARIES) -# set (${PN}_MESSAGE "Found LAPACK: ${_illl};${_illb}") -#endif() -# -#include(FindPackageHandleStandardArgs) -#find_package_handle_standard_args (${PN} DEFAULT_MSG ${PN}_MESSAGE) -# diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 73a6d92f9..e132b98ac 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -108,9 +108,9 @@ if (MSVC) endif() # look for Eigen -find_package(TargetEigen3 MODULE) +find_package(Eigen3 MODULE) -if (TARGET tgt::Eigen) +if (TARGET Eigen3::Eigen) set(LIBINT_HAS_EIGEN 1) set(LIBINT_HAS_CXX_API 1) else() @@ -261,7 +261,7 @@ if (REQUIRE_CXX_API AND NOT MSVC) ${PROJECT_BINARY_DIR}/include/libint2/ ) - target_link_libraries(int-cxx-obj PRIVATE tgt::Eigen) + target_link_libraries(int-cxx-obj PRIVATE Eigen3::Eigen) if (TARGET Boost::headers) target_link_libraries(int-cxx-obj PRIVATE Boost::headers) endif() @@ -327,7 +327,7 @@ if (BUILD_SHARED_LIBS) set_target_properties(int-cxx-headeronly-shared PROPERTIES EXPORT_NAME "cxx") - target_link_libraries(int-cxx-headeronly-shared INTERFACE int-shared tgt::Eigen) + 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() @@ -408,7 +408,7 @@ if (BUILD_STATIC_LIBS) set_target_properties(int-cxx-headeronly-static PROPERTIES EXPORT_NAME "cxx") - target_link_libraries(int-cxx-headeronly-static INTERFACE int-static tgt::Eigen) + 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() @@ -606,7 +606,7 @@ if (BUILD_SHARED_LIBS) INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) #install( - # TARGETS int-shared int-cxx-shared int-cxx-headeronly-shared #tgt::Eigen #libint-Eigen3 + # TARGETS int-shared int-cxx-shared int-cxx-headeronly-shared #Eigen3::Eigen #libint-Eigen3 # EXPORT local_set # LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # ) @@ -667,7 +667,7 @@ if (BUILD_STATIC_LIBS) INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) #install( - # TARGETS int-static int-cxx-static int-cxx-headeronly-static #tgt::Eigen #libint-Eigen3 + # TARGETS int-static int-cxx-static int-cxx-headeronly-static #Eigen3::Eigen #libint-Eigen3 # EXPORT local_set # ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # COMPONENT Eigen3 @@ -717,7 +717,7 @@ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/${pnv}-config-version.cmake - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/FindTargetEigen3.cmake + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/FindEigen3.cmake DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} COMPONENT ${L2}_Development ) diff --git a/src/lib/libint/populate.cmake b/src/lib/libint/populate.cmake index ca4d49fde..2cbd8bde4 100644 --- a/src/lib/libint/populate.cmake +++ b/src/lib/libint/populate.cmake @@ -52,7 +52,7 @@ file(INSTALL "${PROJECT_SOURCE_DIR}/cmake/modules/autocmake_safeguards.cmake" "${PROJECT_SOURCE_DIR}/cmake/modules/options.cmake" "${PROJECT_SOURCE_DIR}/cmake/modules/FindMultiprecision.cmake" "${PROJECT_SOURCE_DIR}/cmake/modules/AddCustomTargetSubproject.cmake" - "${PROJECT_SOURCE_DIR}/cmake/modules/FindTargetEigen3.cmake" + "${PROJECT_SOURCE_DIR}/cmake/modules/FindEigen3.cmake" "${PROJECT_SOURCE_DIR}/cmake/modules/JoinPaths.cmake" "${PROJECT_BINARY_DIR}/cmake/modules/int_computed.cmake" DESTINATION "${EXPORT_STAGE_DIR}/cmake/modules") From 6156ff976ad8aca69ab00016db5ace30d48edb0d Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 10 Feb 2022 17:39:58 -0500 Subject: [PATCH 156/182] ci 92 --- .github/workflows/cmake.yml | 108 ++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 704025c96..c4397a0f6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -16,36 +16,34 @@ jobs: 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 - - #- runs-on: macos-latest - # build_type: Debug - # cxx: clang++ - # args: > - # -DENABLE_FORTRAN=ON - - #- runs-on: windows-2022 - # build_type: Release - # cxx: clang-cl - # args: > - # -DPYBIND11_FINDPYTHON=ON - # -DCMAKE_CXX_FLAGS="-D_=1" + - 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 + + - runs-on: macos-latest + build_type: Debug + cxx: clang++ + cc: clang + args: > + -DENABLE_FORTRAN=ON #-DCMAKE_PREFIX_PATH=/usr/local/Cellar/eigen/3.3.9 @@ -158,8 +156,8 @@ jobs: working-directory: ${{github.workspace}} run: | 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 + #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, full tests) @@ -182,29 +180,31 @@ jobs: path: build/${{ env.ARTIFACT }} retention-days: 1 -# - name: Test installed Libint library -# if: ${{ steps.skip_check.outputs.should_skip != 'true' }} -# shell: bash -l {0} -# working-directory: ${{github.workspace}}/test_installed_library -# run: | -# cat > CMakeLists.txt < CMakeLists.txt < Date: Thu, 10 Feb 2022 22:46:27 -0500 Subject: [PATCH 157/182] ci 93 --- .github/workflows/cmake.yml | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index c4397a0f6..515f13b11 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -44,8 +44,7 @@ jobs: cc: clang args: > -DENABLE_FORTRAN=ON - - #-DCMAKE_PREFIX_PATH=/usr/local/Cellar/eigen/3.3.9 + -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 }} @@ -150,7 +149,7 @@ jobs: restore-keys: | ${{ matrix.config.name }}-ccache- - - name: Generate + Build Libint library (ExternalProject, cplr tests) + - 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}} @@ -160,7 +159,7 @@ jobs: cmake --build build --target library check-libint2compiler install cd build && echo "ARTIFACT=`ls -1 libint*tgz`" >> $GITHUB_ENV - - name: Generate + Build Libint library (FetchContent, full tests) + - 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}} @@ -180,7 +179,7 @@ jobs: path: build/${{ env.ARTIFACT }} retention-days: 1 - - name: Test installed Libint library + - name: Test Installed Libint Library if: ${{ steps.skip_check.outputs.should_skip != 'true' }} shell: bash -l {0} working-directory: ${{github.workspace}}/test_installed_library @@ -254,7 +253,6 @@ jobs: # Note we're not checking out the repo. All src from Linux tarball generated above. - name: Write a Conda Env File - if: ${{ runner.os != 'Windows' }} shell: bash -l {0} run: | cat > export.yaml < export.yaml <=3.16 - - ninja - - python 3.9 - - boost - - eigen - EOF - name: Create Conda Environment uses: conda-incubator/setup-miniconda@v2 From 216cfa87f2dadfa29d6a12e4b6c91fdbf3b5cdc6 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 10 Feb 2022 23:25:29 -0500 Subject: [PATCH 158/182] ci 94 --- .github/workflows/cmake.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 515f13b11..546b87f33 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -267,10 +267,10 @@ jobs: - boost - eigen EOF - if [[ "${{ runner.os }}" != "Windows" ]]; then + 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 From 60ce87b4087cab9ab89f0ef743beb3d03c30f47c Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 11 Feb 2022 02:07:55 -0500 Subject: [PATCH 159/182] rename targets, consolidate exports, remove windows no cmpld cxx --- CMakeLists.txt | 12 -- cmake/libint2-config.cmake.in | 1 - src/lib/libint/CMakeLists.txt.export | 191 ++++++++++----------------- 3 files changed, 71 insertions(+), 133 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b1a46c02..88b1643a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,15 +234,12 @@ 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 @@ -255,8 +252,6 @@ message(STATUS "Showing option LIBINT2_INSTALL_BASISDIR: ${LIBINT2_INSTALL_BASIS #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 @@ -317,17 +312,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) add_subdirectory(doc) -# <<< Test >>> - if (BUILD_TESTING) add_subdirectory(tests) endif() - -# <<< Install >>> - -# nothing to install here diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index f429b416b..cd22540a7 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -86,7 +86,6 @@ # # 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 diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index e132b98ac..af15e78a1 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -236,7 +236,7 @@ if (NOT BUILD_SHARED_LIBS OR LIBINT2_BUILD_SHARED_AND_STATIC_LIBS) endif() # if building CXX API, make an object lib needed for non-header-only version -if (REQUIRE_CXX_API AND NOT MSVC) +if (REQUIRE_CXX_API) add_library(int-cxx-obj OBJECT src/engine.cpp) target_compile_definitions( @@ -333,11 +333,10 @@ if (BUILD_SHARED_LIBS) endif() # now make the compiled library - if (NOT MSVC) - add_library(int-cxx-shared SHARED $) + add_library(int-cxx-compiled-shared SHARED $) set_target_properties( - int-cxx-shared + int-cxx-compiled-shared PROPERTIES SOVERSION ${LIBINT_MAJOR_SOVERSION} MACOSX_RPATH ON @@ -346,7 +345,7 @@ if (BUILD_SHARED_LIBS) ) if (APPLE) set_target_properties( - int-cxx-shared + int-cxx-compiled-shared PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" ) @@ -354,14 +353,13 @@ if (BUILD_SHARED_LIBS) if (MSVC) # necessary but insufficient for dll set_target_properties( - int-cxx-shared + int-cxx-compiled-shared PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON ) endif() - target_link_libraries(int-cxx-shared INTERFACE int-cxx-headeronly-shared) - endif() + target_link_libraries(int-cxx-compiled-shared INTERFACE int-cxx-headeronly-shared) endif() endif() @@ -414,19 +412,17 @@ if (BUILD_STATIC_LIBS) endif() # now make the compiled library - if (NOT MSVC) - add_library(int-cxx-static STATIC $) + add_library(int-cxx-compiled-static STATIC $) set_target_properties( - int-cxx-static + int-cxx-compiled-static PROPERTIES OUTPUT_NAME "int2-cxx" EXPORT_NAME "int2-cxx" ) - target_link_libraries(int-cxx-static INTERFACE int-cxx-headeronly-static) - endif() - endif(REQUIRE_CXX_API) + target_link_libraries(int-cxx-compiled-static INTERFACE int-cxx-headeronly-static) + endif() endif() # Permanent aliases ==================================================================================================== @@ -437,17 +433,13 @@ if (BUILD_SHARED_LIBS) add_library(${L2}::int2 ALIAS int-shared) if (REQUIRE_CXX_API) add_library(${L2}::cxx ALIAS int-cxx-headeronly-shared) - if (NOT MSVC) - add_library(${L2}::int2-cxx ALIAS int-cxx-shared) - endif() + add_library(${L2}::int2-cxx ALIAS int-cxx-compiled-shared) endif() elseif (BUILD_STATIC_LIBS) add_library(${L2}::int2 ALIAS int-static) if (REQUIRE_CXX_API) add_library(${L2}::cxx ALIAS int-cxx-headeronly-static) - if (NOT MSVC) - add_library(${L2}::int2-cxx ALIAS int-cxx-static) - endif() + add_library(${L2}::int2-cxx ALIAS int-cxx-compiled-static) endif() endif() @@ -584,27 +576,30 @@ install( COMPONENT ${L2}_Development ) -#target_include_directories(int-obj PRIVATE ${PROJECT_BINARY_DIR}) - if (BUILD_SHARED_LIBS) - if (TARGET int-cxx-headeronly-shared) # AND TARGET int-cxx-shared) - install( - TARGETS - int-shared - #int-cxx-shared - int-cxx-headeronly-shared - 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} - ) + 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} + ) #install( # TARGETS int-shared int-cxx-shared int-cxx-headeronly-shared #Eigen3::Eigen #libint-Eigen3 # EXPORT local_set @@ -615,80 +610,32 @@ if (BUILD_SHARED_LIBS) # RUNTIME_DEPENDENCY_SET local_set # LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # ) - else() - install( - TARGETS - int-shared - 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} - ) -# install( -# EXPORT shared_set -# DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} -# NAMESPACE "${L2}::" -# FILE ${L2}-Targets-shared.cmake -# COMPONENT ${L2}_Development -# ) - -# install( -# TARGETS int-shared -# EXPORT shared_set -# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -# ) - endif() endif() if (BUILD_STATIC_LIBS) - if (TARGET int-cxx-headeronly-static) # AND TARGET int-cxx-static) - install( - TARGETS - int-static - #int-cxx-static - int-cxx-headeronly-static - 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} - ) - #install( - # TARGETS int-static int-cxx-static int-cxx-headeronly-static #Eigen3::Eigen #libint-Eigen3 - # EXPORT local_set - # ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - # COMPONENT Eigen3 - # ) + 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() - install( - TARGETS - int-static - 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} - ) + 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() # install basis set library @@ -741,16 +688,6 @@ if (BUILD_SHARED_LIBS) DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} COMPONENT ${L2}_Development ) - - if(ENABLE_FORTRAN) - install( - EXPORT fshared_set - FILE "${pnv}-targets-fortran-shared.cmake" - NAMESPACE "${L2}::" - DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} - COMPONENT ${L2}_Development_Fortran - ) - endif() endif() if (BUILD_STATIC_LIBS) @@ -763,6 +700,21 @@ if (BUILD_STATIC_LIBS) ) 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() + #if (EXPORT_LOCAL_TARGETS) # install( # EXPORT local_set @@ -771,4 +723,3 @@ endif() # DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} # ) #endif() - From a151d883952da3298cdec595de08a61c5f1309ee Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 11 Feb 2022 02:29:59 -0500 Subject: [PATCH 160/182] ci 95 --- src/lib/libint/CMakeLists.txt.export | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index af15e78a1..38827d83a 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -335,6 +335,11 @@ if (BUILD_SHARED_LIBS) # now make the compiled library 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 @@ -369,9 +374,7 @@ if (BUILD_STATIC_LIBS) target_compile_features(int-static INTERFACE "cxx_std_11") if(MSVC) - # MSVC does not include constants, unless _USE_MATH_DEFINES is defined. target_compile_definitions(int-static PUBLIC _USE_MATH_DEFINES) - # Set the exception handling model target_compile_options(int-static PUBLIC "/EHsc") endif() @@ -414,6 +417,11 @@ if (BUILD_STATIC_LIBS) # now make the compiled library 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 From c644550739d38c8666924a51a26fec67d33f4c2e Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 11 Feb 2022 02:46:50 -0500 Subject: [PATCH 161/182] ci 96 --- src/lib/libint/CMakeLists.txt.export | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 38827d83a..b9d347f87 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -252,6 +252,13 @@ if (REQUIRE_CXX_API) set_target_properties(int-cxx-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-obj PUBLIC _USE_MATH_DEFINES) + # Set the exception handling model + target_compile_options(int-cxx-obj PUBLIC "/EHsc") + endif() + target_include_directories( int-cxx-obj PRIVATE From 839cd5f5d47c162fcaf63c51d53cb8819d2e1abb Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 11 Feb 2022 10:05:34 -0500 Subject: [PATCH 162/182] ci 97 --- .github/workflows/cmake.yml | 106 ++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 546b87f33..86b1b6e16 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -16,35 +16,35 @@ jobs: 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 - - - runs-on: macos-latest - build_type: Debug - cxx: clang++ - cc: clang - args: > - -DENABLE_FORTRAN=ON - -DCMAKE_Fortran_COMPILER=gfortran-10 +# - 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 +# +# - 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 }} @@ -155,8 +155,8 @@ jobs: working-directory: ${{github.workspace}} run: | 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 + 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, full tests) @@ -179,27 +179,27 @@ jobs: path: build/${{ env.ARTIFACT }} retention-days: 1 - - name: Test Installed Libint Library - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} - shell: bash -l {0} - working-directory: ${{github.workspace}}/test_installed_library - run: | - cat > CMakeLists.txt < CMakeLists.txt < - -DBUILD_SHARED_LIBS=OFF + -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl From 71ea119f5c57703257a597d78c824061111bc17f Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 11 Feb 2022 10:46:16 -0500 Subject: [PATCH 163/182] ci 98 --- src/lib/libint/CMakeLists.txt.export | 33 +++++++++++++++++----------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index b9d347f87..c7f3245b7 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -237,30 +237,39 @@ endif() # if building CXX API, make an object lib needed for non-header-only version if (REQUIRE_CXX_API) - add_library(int-cxx-obj OBJECT src/engine.cpp) + add_library(int-cxx-compiled-obj OBJECT src/engine.cpp) target_compile_definitions( - int-cxx-obj + int-cxx-compiled-obj PUBLIC LIBINT2_DOES_NOT_INLINE_ENGINE=1 __COMPILING_LIBINT2=1 ) - target_compile_features(int-cxx-obj PUBLIC "cxx_std_11") + target_compile_features(int-cxx-compiled-obj PUBLIC "cxx_std_11") if (BUILD_SHARED_LIBS) - set_target_properties(int-cxx-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) + set_target_properties(int-cxx-compiled-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) + + if (MSVC) + # necessary but insufficient for dll + set_target_properties( + int-cxx-compiled-obj + PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS ON + ) + endif() endif() if(MSVC) # MSVC does not include constants, unless _USE_MATH_DEFINES is defined. - target_compile_definitions(int-cxx-obj PUBLIC _USE_MATH_DEFINES) + target_compile_definitions(int-cxx-compiled-obj PUBLIC _USE_MATH_DEFINES) # Set the exception handling model - target_compile_options(int-cxx-obj PUBLIC "/EHsc") + target_compile_options(int-cxx-compiled-obj PUBLIC "/EHsc") endif() target_include_directories( - int-cxx-obj + int-cxx-compiled-obj PRIVATE ${PROJECT_BINARY_DIR}/include/ ${PROJECT_SOURCE_DIR}/src/ @@ -268,9 +277,9 @@ if (REQUIRE_CXX_API) ${PROJECT_BINARY_DIR}/include/libint2/ ) - target_link_libraries(int-cxx-obj PRIVATE Eigen3::Eigen) + target_link_libraries(int-cxx-compiled-obj PRIVATE Eigen3::Eigen) if (TARGET Boost::headers) - target_link_libraries(int-cxx-obj PRIVATE Boost::headers) + target_link_libraries(int-cxx-compiled-obj PRIVATE Boost::headers) endif() endif() @@ -278,9 +287,7 @@ if (BUILD_SHARED_LIBS) add_library(int-shared SHARED $) if(MSVC) - # MSVC does not include constants, unless _USE_MATH_DEFINES is defined. target_compile_definitions(int-shared PUBLIC _USE_MATH_DEFINES) - # Set the exception handling model target_compile_options(int-shared PUBLIC "/EHsc") endif() @@ -340,7 +347,7 @@ if (BUILD_SHARED_LIBS) endif() # now make the compiled library - add_library(int-cxx-compiled-shared SHARED $) + add_library(int-cxx-compiled-shared SHARED $) if(MSVC) target_compile_definitions(int-cxx-compiled-shared PUBLIC _USE_MATH_DEFINES) @@ -422,7 +429,7 @@ if (BUILD_STATIC_LIBS) endif() # now make the compiled library - add_library(int-cxx-compiled-static STATIC $) + add_library(int-cxx-compiled-static STATIC $) if(MSVC) target_compile_definitions(int-cxx-compiled-static PUBLIC _USE_MATH_DEFINES) From bb993a8ebc054b62bcb51c23b85beb82f0637d6b Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 11 Feb 2022 11:54:17 -0500 Subject: [PATCH 164/182] ci 99 --- .github/workflows/cmake.yml | 1 + CMakeLists.txt | 1 + cmake/libint2-config.cmake.in | 23 +++++++++++++---------- src/lib/libint/CMakeLists.txt | 1 + src/lib/libint/CMakeLists.txt.export | 23 ++++++++++++++--------- 5 files changed, 30 insertions(+), 19 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 86b1b6e16..9383fbeaa 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -245,6 +245,7 @@ jobs: -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl + -DREQUIRE_CXX_API_COMPILED=OFF name: "Export • ${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.args }}" runs-on: ${{ matrix.cfg.runs-on }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 88b1643a2..6b804efc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,6 +76,7 @@ option_with_default(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT "[EXPERT] Build generated ### 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) diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index cd22540a7..842ba4a9b 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: @@ -101,10 +101,10 @@ set(Libint2_EXT_VERSION "@LIBINT_EXT_VERSION@") list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) # check library style component -if(@BUILD_SHARED_LIBS@) +if(@BUILD_SHARED_LIBS@) # BUILD_SHARED_LIBS set(${L2}_shared_FOUND 1) endif() -if(@BUILD_STATIC_LIBS@) +if(@BUILD_STATIC_LIBS@) # BUILD_STATIC_LIBS set(${L2}_static_FOUND 1) endif() list(FIND ${L2}_FIND_COMPONENTS "shared" _seek_shared) @@ -115,7 +115,7 @@ include(CMakeFindDependencyMacro) set(${L2}_C_FOUND 1) list(FIND ${L2}_FIND_COMPONENTS "C" _seek_C) -if(@REQUIRE_CXX_API@) +if(@REQUIRE_CXX_API@) # REQUIRE_CXX_API if(NOT TARGET Eigen3::Eigen) find_dependency(Eigen3 REQUIRED) endif() @@ -132,11 +132,14 @@ if(@REQUIRE_CXX_API@) endif() set(${L2}_CXX_ho_FOUND 1) - set(${L2}_CXX_FOUND 1) + + if(@REQUIRE_CXX_API_COMPILED@) # REQUIRE_CXX_API_COMPILED + set(${L2}_CXX_FOUND 1) + endif() endif() list(FIND ${L2}_FIND_COMPONENTS "CXX_ho" _seek_CXX_ho) list(FIND ${L2}_FIND_COMPONENTS "CXX" _seek_CXX) -if(@ENABLE_FORTRAN@) +if(@ENABLE_FORTRAN@) # ENABLE_FORTRAN set(${L2}_Fortran_FOUND 1) endif() list(FIND ${L2}_FIND_COMPONENTS "Fortran" _seek_Fortran) @@ -148,12 +151,12 @@ foreach(_eri @Libint2_ERI_COMPONENTS@) endforeach() # check pure restriction component -if((@ERI3_PURE_SH@ EQUAL 0) AND (@ERI2_PURE_SH@ EQUAL 0)) +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 +# 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)) @@ -239,9 +242,9 @@ if(NOT TARGET ${L2}::int2) 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() diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index abd8e8be0..b4bd1c98a 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -92,6 +92,7 @@ else() -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} diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index c7f3245b7..67a0df352 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -36,12 +36,17 @@ include(options) 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(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(EXPORT_LOCAL_TARGETS "Install CMake targets with hard-coded dependency paths. Turn OFF when building library for redistribution." ON) +if (REQUIRE_CXX_API_COMPILED AND NOT REQUIRE_CXX_API) + set(REQUIRE_CXX_API 1) +endif() + if (NOT LIBINT2_REALTYPE) set(LIBINT2_REALTYPE double) endif() @@ -236,7 +241,7 @@ if (NOT BUILD_SHARED_LIBS OR LIBINT2_BUILD_SHARED_AND_STATIC_LIBS) endif() # if building CXX API, make an object lib needed for non-header-only version -if (REQUIRE_CXX_API) +if (REQUIRE_CXX_API_COMPILED) add_library(int-cxx-compiled-obj OBJECT src/engine.cpp) target_compile_definitions( @@ -251,14 +256,6 @@ if (REQUIRE_CXX_API) if (BUILD_SHARED_LIBS) set_target_properties(int-cxx-compiled-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) - if (MSVC) - # necessary but insufficient for dll - set_target_properties( - int-cxx-compiled-obj - PROPERTIES - WINDOWS_EXPORT_ALL_SYMBOLS ON - ) - endif() endif() if(MSVC) @@ -347,6 +344,7 @@ if (BUILD_SHARED_LIBS) endif() # now make the compiled library + if (REQUIRE_CXX_API_COMPILED) add_library(int-cxx-compiled-shared SHARED $) if(MSVC) @@ -379,6 +377,7 @@ if (BUILD_SHARED_LIBS) endif() target_link_libraries(int-cxx-compiled-shared INTERFACE int-cxx-headeronly-shared) + endif() endif() endif() @@ -429,6 +428,7 @@ if (BUILD_STATIC_LIBS) endif() # now make the compiled library + if (REQUIRE_CXX_API_COMPILED) add_library(int-cxx-compiled-static STATIC $) if(MSVC) @@ -444,6 +444,7 @@ if (BUILD_STATIC_LIBS) ) target_link_libraries(int-cxx-compiled-static INTERFACE int-cxx-headeronly-static) + endif() endif() endif() @@ -455,13 +456,17 @@ if (BUILD_SHARED_LIBS) 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(${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() From a3046d3941ed8dd4622a2cee09544407039865c1 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 11 Feb 2022 14:08:17 -0500 Subject: [PATCH 165/182] ci 100 --- .github/workflows/cmake.yml | 112 ++++++++++++++++----------------- INSTALL.md | 28 ++++++++- cmake/modules/FindEigen3.cmake | 5 +- 3 files changed, 82 insertions(+), 63 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9383fbeaa..d1702bc36 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -16,35 +16,35 @@ jobs: 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 -# -# - runs-on: macos-latest -# build_type: Debug -# cxx: clang++ -# cc: clang -# args: > -# -DENABLE_FORTRAN=ON -# -DCMAKE_Fortran_COMPILER=gfortran-10 + - 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 + + - 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 }} @@ -94,16 +94,12 @@ jobs: if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'macOS' }} run: | brew install ninja gcc@10 boost eigen ccache - #echo "FC=/usr/local/bin/gfortran-10" >> $GITHUB_ENV - #echo "EIGEN3_INCLUDE_DIR=/usr/local/include/eigen3" >> $GITHUB_ENV - 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 ${{ matrix.cfg.cxx }} ${{ matrix.cfg.fc }} 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 - name: Install Windows prerequisites, part 1, Create Conda Environment if: ${{ steps.skip_check.outputs.should_skip != 'true' && runner.os == 'Windows' }} @@ -155,8 +151,8 @@ jobs: working-directory: ${{github.workspace}} run: | 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 + #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, full tests) @@ -179,27 +175,27 @@ jobs: path: build/${{ env.ARTIFACT }} retention-days: 1 -# - name: Test Installed Libint Library -# if: ${{ steps.skip_check.outputs.should_skip != 'true' }} -# shell: bash -l {0} -# working-directory: ${{github.workspace}}/test_installed_library -# run: | -# cat > CMakeLists.txt < CMakeLists.txt < - -DBUILD_SHARED_LIBS=ON + -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl - -DREQUIRE_CXX_API_COMPILED=OFF name: "Export • ${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.args }}" runs-on: ${{ matrix.cfg.runs-on }} @@ -276,6 +271,7 @@ jobs: - name: Create Conda Environment uses: conda-incubator/setup-miniconda@v2 with: + mamba-version: "*" activate-environment: test channels: conda-forge environment-file: export.yaml diff --git a/INSTALL.md b/INSTALL.md index bf93ffad3..68b7b552a 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -87,14 +87,17 @@ cmake/ COPYING src/ tests/ ... ``` -| target | incl. | steps | ( | see | below | ) | -| ------ | ----- | ----- | ----- | ----- | ----- | ----- | +| `--target ...` | incl. | steps | ( | see | below | ) | +| -------------- | ----- | ----- | ----- | ----- | ----- | ----- | | 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. The build is structured into three parts: @@ -293,12 +296,31 @@ These are the most useful configure options: * `--prefix=path` --> `-D CMAKE_INSTALL_PREFIX=path` (standard CMake variable) +* `--with-cmakedir=partialpath` --> `-D LIBINT2_INSTALL_CMAKEDIR=partialpath` + * Targets * All targets listed below are available. rhs of arrow targets (namespaced with `Libint2::`) are preferred. lhs of arrow targets have legacy aliases for now. * Namespaced targets available through `find_package()` or `add_subdirectory()` * `libint2` --> `Libint2::int2` (internal target name `int-{shared,static}`) * `libint2_cxx` --> `Libint2::cxx` (internal target name `int-cxx-headeronly-{shared,static}`) - * DNE --> `Libint2::int2-cxx` (internal target name `int-cxx-{shared,static}`) + * DNE --> `Libint2::int2-cxx` (internal target name `int-cxx-compiled-{shared,static}`) + * never use internal names + + + +| Namespaced Target[^16] | Component[^15] | 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}` | +| `Libint2::fortran` | (NYI) | no | `ENABLE_FORTRAN=ON` | `ENABLE_FORTRAN=OFF` | `libint_f` | + + +[^15]: Ensure target found in installation after `find_package(Libint2 COMPONENTS ...)`. +[^16]: Targets for library consumer use. These are available after `find_package(Libint2)` or `add_subdirectory()`. +[^17]: +[^18]: Deprecated legacy aliases. Update any uses to namespaced target. ## Packagers diff --git a/cmake/modules/FindEigen3.cmake b/cmake/modules/FindEigen3.cmake index 46b55d6a0..2a5e8b156 100644 --- a/cmake/modules/FindEigen3.cmake +++ b/cmake/modules/FindEigen3.cmake @@ -2,7 +2,8 @@ # ---------------------- # # 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. # * # # - Try to find Eigen3 lib @@ -82,7 +83,7 @@ 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) + 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 From 4ce76a1f37f9f25e7ee98eb439d62dae00e5cca6 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Fri, 11 Feb 2022 17:14:58 -0500 Subject: [PATCH 166/182] cmake back to 3.16 --- .github/workflows/cmake.yml | 6 ++-- CMakeLists.txt | 2 +- INSTALL.md | 44 +++++++++++++--------------- cmake/modules/int_am.cmake | 24 +++++++++------ src/lib/libint/CMakeLists.txt.export | 14 +++++---- 5 files changed, 47 insertions(+), 43 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d1702bc36..2459aac8a 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -119,7 +119,7 @@ jobs: shell: bash -l {0} run: | conda info - conda install ninja cmake python mpir boost eigen ccache -c conda-forge --yes + conda install ninja cmake=3.16 python mpir boost eigen ccache -c conda-forge --yes conda list - name: Prepare compiler environment for Windows @@ -181,7 +181,7 @@ jobs: working-directory: ${{github.workspace}}/test_installed_library run: | cat > CMakeLists.txt < CMakeLists.txt < `-D LIBINT2_INSTALL_CMAKEDIR=partialpath` -* Targets - * All targets listed below are available. rhs of arrow targets (namespaced with `Libint2::`) are preferred. lhs of arrow targets have legacy aliases for now. - * Namespaced targets available through `find_package()` or `add_subdirectory()` - * `libint2` --> `Libint2::int2` (internal target name `int-{shared,static}`) - * `libint2_cxx` --> `Libint2::cxx` (internal target name `int-cxx-headeronly-{shared,static}`) - * DNE --> `Libint2::int2-cxx` (internal target name `int-cxx-compiled-{shared,static}`) - * never use internal names +## Targets + * `libint2` --> `Libint2::int2` + * `libint2_cxx` --> `Libint2::cxx` -| Namespaced Target[^16] | Component[^15] | 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}` | -| `Libint2::fortran` | (NYI) | no | `ENABLE_FORTRAN=ON` | `ENABLE_FORTRAN=OFF` | `libint_f` | +| 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]: Ensure target found in installation after `find_package(Libint2 COMPONENTS ...)`. -[^16]: Targets for library consumer use. These are available after `find_package(Libint2)` or `add_subdirectory()`. -[^17]: +[^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 diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index c3a1120c7..b0bcade30 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -11,13 +11,23 @@ # `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 derivatives level >>> set(_glob_classes_derivs ${ENABLE_ONEBODY};${ENABLE_ERI};${ENABLE_ERI3};${ENABLE_ERI2};${ENABLE_G12};${ENABLE_G12DKH}) -list(SORT _glob_classes_derivs COMPARE NATURAL ORDER DESCENDING) # CMake 3.18 for NATURAL -list(GET _glob_classes_derivs 0 _max_deriv) +numerical_max_of_list(_max_deriv "${_glob_classes_derivs}") message(STATUS "Preparing highest derivative level ${_max_deriv}") # <<< overall max_am defaults >>> @@ -29,9 +39,7 @@ if (_ntokens_maxam GREATER 1) 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() - set(_sorted_WITH_MAX_AM ${WITH_MAX_AM}) - list(SORT _sorted_WITH_MAX_AM COMPARE NATURAL ORDER DESCENDING) - list(GET _sorted_WITH_MAX_AM 0 _max_am) + numerical_max_of_list(_max_am "${WITH_MAX_AM}") list(JOIN WITH_MAX_AM "," _sam) set(LIBINT_MAX_AM_LIST ${_sam}) @@ -83,8 +91,7 @@ if (_ntokens_optam GREATER 1) endforeach() list(JOIN _processed_OPT_AM_LIST "," LIBINT_OPT_AM_LIST) - list(SORT _processed_OPT_AM_LIST COMPARE NATURAL ORDER DESCENDING) - list(GET _processed_OPT_AM_LIST 0 LIBINT_OPT_AM) + numerical_max_of_list(LIBINT_OPT_AM "${_processed_OPT_AM_LIST}") else() if(WITH_OPT_AM EQUAL -1) if (_ntokens_maxam GREATER 1) @@ -98,8 +105,7 @@ else() endforeach() list(JOIN _processed_OPT_AM_LIST "," LIBINT_OPT_AM_LIST) - list(SORT _processed_OPT_AM_LIST COMPARE NATURAL ORDER DESCENDING) - list(GET _processed_OPT_AM_LIST 0 LIBINT_OPT_AM) + 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 "") diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 67a0df352..5cf4b1875 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.18) # LIST SORT NATURAL +cmake_minimum_required(VERSION 3.16) cmake_policy(SET CMP0074 NEW) ############################# Version and Metadata ############################# @@ -701,11 +701,13 @@ 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/ - COMPONENT ${L2}_Development - ) +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( From 52af246573fe13ac1b83c0138c59dd90a1825e47 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Sat, 12 Feb 2022 01:00:41 -0500 Subject: [PATCH 167/182] allow handing eigen3 btwn l2 library build and consumer build --- cmake/modules/FindEigen3.cmake | 23 +++++++++-- cmake/modules/int_am.cmake | 10 ++--- src/lib/libint/CMakeLists.txt | 5 +++ src/lib/libint/CMakeLists.txt.export | 59 ++++++++++++++++++---------- 4 files changed, 69 insertions(+), 28 deletions(-) diff --git a/cmake/modules/FindEigen3.cmake b/cmake/modules/FindEigen3.cmake index 2a5e8b156..7a5e42cd4 100644 --- a/cmake/modules/FindEigen3.cmake +++ b/cmake/modules/FindEigen3.cmake @@ -1,10 +1,10 @@ # 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. # # - Try to find Eigen3 lib # @@ -71,7 +71,24 @@ macro(_eigen3_check_version) endif() endmacro() -if (EIGEN3_INCLUDE_DIR) +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() diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index b0bcade30..f4b15a6e4 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -3,11 +3,12 @@ # * [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 +# 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)` @@ -40,7 +41,6 @@ if (_ntokens_maxam GREATER 1) 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 @@ -333,7 +333,7 @@ else() endif() -# form list of active class + deriv + max_am 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 ERI;ERI3;ERI2;ONEBODY;G12;G12DKH) if (_cls STREQUAL "ERI") diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index b4bd1c98a..b99d2ff70 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -113,6 +113,11 @@ else() "-DEigen3_DIR=${Eigen3_DIR}" ) endif() + if (LIBINT_LOCAL_EIGEN3_INSTALL) + list(APPEND library_CMAKE_ARGS + "-DLIBINT_LOCAL_EIGEN3_INSTALL=${LIBINT_LOCAL_EIGEN3_INSTALL}" + ) + endif() message(STATUS "invoking ExternalProject_add to build+test Libint library with library_CMAKE_ARGS=${library_CMAKE_ARGS}") ExternalProject_Add(library diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 5cf4b1875..576d5141b 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -41,7 +41,7 @@ option_with_print(ENABLE_FORTRAN "Build Fortran03+ Libint interface (requires C 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(EXPORT_LOCAL_TARGETS "Install CMake targets with hard-coded dependency paths. Turn OFF when building library for redistribution." ON) +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) if (REQUIRE_CXX_API_COMPILED AND NOT REQUIRE_CXX_API) set(REQUIRE_CXX_API 1) @@ -627,16 +627,6 @@ if (BUILD_SHARED_LIBS) COMPONENT ${L2}_Development INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) - #install( - # TARGETS int-shared int-cxx-shared int-cxx-headeronly-shared #Eigen3::Eigen #libint-Eigen3 - # EXPORT local_set - # LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - # ) -# install( -# IMPORTED_RUNTIME_ARTIFACTS int-cxx-shared -# RUNTIME_DEPENDENCY_SET local_set -# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -# ) endif() if (BUILD_STATIC_LIBS) @@ -665,6 +655,34 @@ if (BUILD_STATIC_LIBS) ) 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 @@ -729,6 +747,16 @@ if (BUILD_STATIC_LIBS) ) 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 @@ -743,12 +771,3 @@ endif() # COMPONENT ${L2}_Development_Fortran # ) # endif() - -#if (EXPORT_LOCAL_TARGETS) -# install( -# EXPORT local_set -# FILE "${pnv}-targets-local.cmake" -# NAMESPACE "${L2}::" -# DESTINATION ${LIBINT2_INSTALL_CMAKEDIR} -# ) -#endif() From 79345b2c6f696b4e61ed6f64a8c1cb3d1f5c85f4 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Sat, 12 Feb 2022 10:59:07 -0500 Subject: [PATCH 168/182] ci 101 --- .github/workflows/cmake.yml | 90 +++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 43 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2459aac8a..ac76f9ef7 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -16,35 +16,35 @@ jobs: 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 - - - runs-on: macos-latest - build_type: Debug - cxx: clang++ - cc: clang - args: > - -DENABLE_FORTRAN=ON - -DCMAKE_Fortran_COMPILER=gfortran-10 +# - 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 +# +# - 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 }} @@ -151,8 +151,8 @@ jobs: working-directory: ${{github.workspace}} run: | 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 + 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, full tests) @@ -176,7 +176,8 @@ jobs: retention-days: 1 - name: Test Installed Libint Library - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} + if: false # toggle for quick tarball to debug `build_export` + #if: ${{ steps.skip_check.outputs.should_skip != 'true' }} shell: bash -l {0} working-directory: ${{github.workspace}}/test_installed_library run: | @@ -226,23 +227,25 @@ jobs: matrix: cfg: - runs-on: ubuntu-latest - args: > + libargs: > -DBUILD_SHARED_LIBS=ON - -DCMAKE_BUILD_TYPE=Release + testargs: "" - runs-on: macos-latest - args: > + libargs: > -DBUILD_SHARED_LIBS=ON - -DCMAKE_BUILD_TYPE=Release + testargs: "" - runs-on: windows-latest - args: > + libargs: > -DBUILD_SHARED_LIBS=OFF - -DCMAKE_BUILD_TYPE=Release + -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.args }}" + name: "Export • ${{ matrix.cfg.runs-on }} • ${{ matrix.cfg.libargs }}" runs-on: ${{ matrix.cfg.runs-on }} steps: @@ -285,9 +288,10 @@ jobs: # Step is unnecessary. Its presence forces testing non-target Eigen installs - name: Confound Environment wrt Eigen - if: ${{ runner.os == 'Linux' }} + if: ${{ runner.os == 'Windows' }} shell: bash -l {0} - run: rm -rf "${CONDA_PREFIX}/share/eigen3/cmake/" + run: rm -rf "${CONDA_PREFIX}/Library/share/eigen3/cmake/" + #run: rm -rf "${CONDA_PREFIX}/share/eigen3/cmake/" - name: Environment Information shell: bash -l {0} @@ -318,7 +322,7 @@ jobs: -DCMAKE_INSTALL_PREFIX="${{github.workspace}}/installed" \ -DCMAKE_CXX_COMPILER=${CXX} \ -DCMAKE_PREFIX_PATH="${CONDA_PREFIX}" \ - ${{ matrix.cfg.args }} + ${{ matrix.cfg.libargs }} cmake --build build --target install - name: Test Installed Libint library @@ -333,7 +337,7 @@ jobs: add_executable(hf++ EXCLUDE_FROM_ALL "../libint/tests/hartree-fock/hartree-fock++.cc") target_link_libraries(hf++ Libint2::cxx Threads::Threads) EOF - cmake -S . -B build -G Ninja -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" ${{ matrix.cfg.args }} + cmake -S . -B build -G Ninja -D CMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{github.workspace}}/installed" ${{ matrix.cfg.testargs }} cmake --build build --target hf++ ./build/hf++ ../libint/tests/hartree-fock/h2o_rotated.xyz | python ../libint/tests/hartree-fock/hartree-fock++-validate.py ../libint/features From 43a847517d0b5fbb0bc2f58ef6887dc180cde8ca Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Sat, 12 Feb 2022 13:23:07 -0500 Subject: [PATCH 169/182] ci 102 xfail --- .github/workflows/cmake.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ac76f9ef7..884ba557c 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -229,7 +229,9 @@ jobs: - runs-on: ubuntu-latest libargs: > -DBUILD_SHARED_LIBS=ON - testargs: "" + -DLIBINT_LOCAL_EIGEN3_INSTALL=ON + testargs: > + -DLIBINT_LOCAL_EIGEN3_FIND=OFF - runs-on: macos-latest libargs: > @@ -291,7 +293,14 @@ jobs: if: ${{ runner.os == 'Windows' }} shell: bash -l {0} run: rm -rf "${CONDA_PREFIX}/Library/share/eigen3/cmake/" - #run: rm -rf "${CONDA_PREFIX}/share/eigen3/cmake/" + + # Step is unnecessary. + - name: Confound Environment wrt 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} From 8d949e9f13eb4b7ef5c8016e4d17097a9408004b Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Sat, 12 Feb 2022 13:43:15 -0500 Subject: [PATCH 170/182] ci 103 xfail --- .github/workflows/cmake.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 884ba557c..4f76d0ab3 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -230,6 +230,7 @@ jobs: libargs: > -DBUILD_SHARED_LIBS=ON -DLIBINT_LOCAL_EIGEN3_INSTALL=ON + -DEigen3_ROOT="/usr/local/miniconda/envs/onlyeigen/" testargs: > -DLIBINT_LOCAL_EIGEN3_FIND=OFF From 55b350338617b78281add2a82cc7448cdb968e7a Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Sat, 12 Feb 2022 14:35:50 -0500 Subject: [PATCH 171/182] ci 104 xfail --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4f76d0ab3..007d3f487 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -230,7 +230,7 @@ jobs: libargs: > -DBUILD_SHARED_LIBS=ON -DLIBINT_LOCAL_EIGEN3_INSTALL=ON - -DEigen3_ROOT="/usr/local/miniconda/envs/onlyeigen/" + -DEigen3_ROOT="/usr/share/miniconda/envs/onlyeigen/" testargs: > -DLIBINT_LOCAL_EIGEN3_FIND=OFF From e5155f8e484ab9d4946dd8346b8ea08d66ca2e58 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Sat, 12 Feb 2022 15:53:36 -0500 Subject: [PATCH 172/182] ci 105 --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 007d3f487..55c3860cf 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -232,7 +232,7 @@ jobs: -DLIBINT_LOCAL_EIGEN3_INSTALL=ON -DEigen3_ROOT="/usr/share/miniconda/envs/onlyeigen/" testargs: > - -DLIBINT_LOCAL_EIGEN3_FIND=OFF + -DLIBINT_LOCAL_EIGEN3_FIND=ON - runs-on: macos-latest libargs: > From 1604b957dbf5d01e43327fad37e5925d9b20172c Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Sat, 12 Feb 2022 16:24:37 -0500 Subject: [PATCH 173/182] ci 106 --- .github/workflows/cmake.yml | 82 ++++++++++++++-------------- cmake/modules/FindEigen3.cmake | 4 +- src/lib/libint/CMakeLists.txt | 4 +- src/lib/libint/CMakeLists.txt.export | 42 +------------- 4 files changed, 48 insertions(+), 84 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 55c3860cf..babcec252 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -16,35 +16,35 @@ jobs: 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 -# -# - runs-on: macos-latest -# build_type: Debug -# cxx: clang++ -# cc: clang -# args: > -# -DENABLE_FORTRAN=ON -# -DCMAKE_Fortran_COMPILER=gfortran-10 + - 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 + + - 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 }} @@ -151,8 +151,8 @@ jobs: working-directory: ${{github.workspace}} run: | 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 + #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, full tests) @@ -176,8 +176,8 @@ jobs: 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' }} + #if: false # toggle for quick tarball to debug `build_export` + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} shell: bash -l {0} working-directory: ${{github.workspace}}/test_installed_library run: | @@ -229,10 +229,10 @@ jobs: - runs-on: ubuntu-latest libargs: > -DBUILD_SHARED_LIBS=ON - -DLIBINT_LOCAL_EIGEN3_INSTALL=ON + -DLIBINT_LOCAL_Eigen3_INSTALL=ON -DEigen3_ROOT="/usr/share/miniconda/envs/onlyeigen/" testargs: > - -DLIBINT_LOCAL_EIGEN3_FIND=ON + -DLIBINT_LOCAL_Eigen3_FIND=ON - runs-on: macos-latest libargs: > @@ -283,20 +283,20 @@ jobs: environment-file: export.yaml show-channel-urls: true - # Step is unnecessary. Its presence forces testing bundled Boost - - name: Confound Environment wrt Boost + # 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. Its presence forces testing non-target Eigen installs - - name: Confound Environment wrt Eigen + # 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. - - name: Confound Environment wrt Eigen + # 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: | diff --git a/cmake/modules/FindEigen3.cmake b/cmake/modules/FindEigen3.cmake index 7a5e42cd4..7ebac9f42 100644 --- a/cmake/modules/FindEigen3.cmake +++ b/cmake/modules/FindEigen3.cmake @@ -4,7 +4,7 @@ # 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. +# * Added `LIBINT_LOCAL_Eigen3_FIND` block to forcibly load hard-coded Eigen3 location detected during Libint2 library build. # # - Try to find Eigen3 lib # @@ -71,7 +71,7 @@ macro(_eigen3_check_version) endif() endmacro() -if (LIBINT_LOCAL_EIGEN3_FIND) +if (LIBINT_LOCAL_Eigen3_FIND) include("${CMAKE_CURRENT_LIST_DIR}/libint2-targets-eigen3.cmake") if (TARGET Libint2::Eigen) diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index b99d2ff70..9af9a398b 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -113,9 +113,9 @@ else() "-DEigen3_DIR=${Eigen3_DIR}" ) endif() - if (LIBINT_LOCAL_EIGEN3_INSTALL) + if (LIBINT_LOCAL_Eigen3_INSTALL) list(APPEND library_CMAKE_ARGS - "-DLIBINT_LOCAL_EIGEN3_INSTALL=${LIBINT_LOCAL_EIGEN3_INSTALL}" + "-DLIBINT_LOCAL_Eigen3_INSTALL=${LIBINT_LOCAL_Eigen3_INSTALL}" ) endif() message(STATUS "invoking ExternalProject_add to build+test Libint library with library_CMAKE_ARGS=${library_CMAKE_ARGS}") diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index 576d5141b..a845cf113 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -41,7 +41,7 @@ option_with_print(ENABLE_FORTRAN "Build Fortran03+ Libint interface (requires C 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_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) if (REQUIRE_CXX_API_COMPILED AND NOT REQUIRE_CXX_API) set(REQUIRE_CXX_API 1) @@ -112,7 +112,6 @@ if (MSVC) set(LIBINT2_ALIGN_SIZE "0" CACHE STRING "(LAB) I so don't understand the option handling of ALIGN_SIZE") endif() -# look for Eigen find_package(Eigen3 MODULE) if (TARGET Eigen3::Eigen) @@ -158,41 +157,6 @@ if (REQUIRE_CXX_API) 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() -# # 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() -# add_library(libint-Eigen3 INTERFACE) -# set_property(TARGET libint-Eigen3 PROPERTY -# INTERFACE_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIR}) -# endif() -# endif() -#endif() -#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}") -#endif() - -#if (TARGET libint-Eigen3) - - # Python is optionally used for testing, but for Fortran, it's required for preprocessing. if (ENABLE_FORTRAN) find_package(Python COMPONENTS Interpreter REQUIRED) @@ -655,7 +619,7 @@ if (BUILD_STATIC_LIBS) ) endif() -if (LIBINT_LOCAL_EIGEN3_INSTALL AND TARGET Eigen3::Eigen) +if (LIBINT_LOCAL_Eigen3_INSTALL AND TARGET Eigen3::Eigen) add_library(Eigen INTERFACE) foreach(prop @@ -747,7 +711,7 @@ if (BUILD_STATIC_LIBS) ) endif() -if (LIBINT_LOCAL_EIGEN3_INSTALL AND TARGET Eigen3::Eigen) +if (LIBINT_LOCAL_Eigen3_INSTALL AND TARGET Eigen3::Eigen) install( EXPORT local_set FILE "${pnv}-targets-eigen3.cmake" From af6febc33f26f909588bf50ec42d19e6d7130bee Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Sat, 12 Feb 2022 21:52:59 -0500 Subject: [PATCH 174/182] cleanup --- CMakeLists.txt | 3 +-- cmake/libint2-config.cmake.in | 2 ++ src/bin/libint/CMakeLists.txt | 4 ++-- src/lib/libint/CMakeLists.txt.export | 1 - 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67816ff50..3e68cef06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,8 +64,7 @@ set(pnv libint2) # projectnameversion include(options) include(GNUInstallDirs) include(CTest) -message(STATUS "Building using CMake ${CMAKE_VERSION}") -message(STATUS "Generating using ${CMAKE_GENERATOR}: ${CMAKE_GENERATOR_INSTANCE}") +message(STATUS "Building using CMake ${CMAKE_VERSION} Generator ${CMAKE_GENERATOR}") # <<< General >>> diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index 842ba4a9b..ff419a6f2 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -21,6 +21,8 @@ # # 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) # # impure_sh - search for library that doesn't assume 2- and 3-center integrals involve pure solid harmonics # diff --git a/src/bin/libint/CMakeLists.txt b/src/bin/libint/CMakeLists.txt index 4977349a4..ffb0b896f 100644 --- a/src/bin/libint/CMakeLists.txt +++ b/src/bin/libint/CMakeLists.txt @@ -79,8 +79,8 @@ endif() add_executable(build_libint EXCLUDE_FROM_ALL build_libint.cc) target_link_libraries(build_libint libint-libcompiler) if(MSVC) - # Increase stack size from 1 MB to 8 MB - set_target_properties(build_libint PROPERTIES LINK_FLAGS "/STACK:8388608") + # Increase stack size from 1 MB to 4 MB + set_target_properties(build_libint PROPERTIES LINK_FLAGS "/STACK:4194304") endif() set_target_properties(build_libint diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index a845cf113..a977e523d 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -219,7 +219,6 @@ if (REQUIRE_CXX_API_COMPILED) if (BUILD_SHARED_LIBS) set_target_properties(int-cxx-compiled-obj PROPERTIES POSITION_INDEPENDENT_CODE 1) - endif() if(MSVC) From f39522285af490ab9507dd1d5917fefcb60c9a91 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Mon, 14 Feb 2022 02:07:35 -0500 Subject: [PATCH 175/182] Update INSTALL.md --- INSTALL.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 2bef834cb..477a8ed0c 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -14,18 +14,18 @@ Before you read on: # Prerequisites -| Task | Compilers | CMake[^3] | CMake generator | Boost[^7] | Eigen | GMPXX[^13] | MPFR[^14] | -| :------------------------------------------------------------------- | :---------------------: | :-------: | --------------- | :-------: | :-----: | :--------: | :-------: | -| build target `build_libint` | C++[^1] | 🔵[^4] | Ninja | 🔵[^8] | – | 🔵 | – | -| build target `library` | C++[^1], C | 🔵[^5] | Ninja | – | – | – | – | -|   `-D REQUIRE_CXX_API=ON` | C++[^1], C | 🔵[^5] | Ninja | 🔸[^9] | 🔵[^11] | – | – | -|   `-D ENABLE_FORTRAN=ON` | C++[^1], Fortran[^2], C | 🔵[^5] | Ninja | – | – | – | – | +| 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 | | | – | – | +|  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 @@ -59,6 +59,12 @@ Before you read on: [^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. + # Synopsis - configure: `cmake -S /path/to/compiler/source/tree -B build [-Dvar1=value1] [-Dvar2=value2] ...` where From 3b3c7a207d645e907482ec7db1e5e7aafc26eb70 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 15 Feb 2022 01:15:45 -0500 Subject: [PATCH 176/182] work on install --- INSTALL.md | 219 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 171 insertions(+), 48 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 477a8ed0c..4f88580f9 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,16 +1,120 @@ -# libint compiler vs library +# 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) +- master status: [![Build Status](https://travis-ci.org/evaleev/libint.svg?branch=master)](https://travis-ci.org/evaleev/libint) +- project page: http://libint.valeyev.net/ +- e-mail - libint@valeyev.net + +See [the INSTALL.md file](INSTALL.md) for installation instructions and links to usage instructions. + +Copyright (C) 2004-2022 Edward F. Valeev + +----------------------------------------------------------------------------- + +# Libint Compiler vs Library Before you read on: +* If you want a pre-build 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 know how to _generate_ a libint _library_ using the libint _compiler_, first make sure you really need to do that: +* 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 _do_ need to make a custom library, _read on_ + * _read on_ if you need compilation directions, 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_. + +----------------------------------------------------------------------------- +# 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. + - 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 +----------------------------------------------------------------------------- + + +----------------------------------------------------------------------------- + + +----------------------------------------------------------------------------- + + +----------------------------------------------------------------------------- + + +----------------------------------------------------------------------------- + + +----------------------------------------------------------------------------- + + +----------------------------------------------------------------------------- + + +Eigen3_ROOT to prefix when cmake in place +EIGEN3_INCLUDE_DIR? + -D CMAKE_PREFIX_PATH="/psi/toolchainconda/envs/singleboost;/psi/toolchainconda/envs/singlegmp;/psi/toolchainconda/envs/singleeigen" \ + +* 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 ???_ROOT="/home/miniconda/envs/onlyboost" + -D ???_ROOT="/home/miniconda/envs/onlygmp" + -D Eigen3_ROOT="/home/miniconda/envs/onlyeigen" + ``` + +* +# Libint2_DIR - CMake variable, set to directory containing this Config file +# CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package + +******************************* # Prerequisites @@ -33,9 +137,9 @@ Before you read on: [^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. +[^2]: Fortran 2003 compiler to enable Fortran bindings generation. -[^3]: CMake 3.16 or higher. +[^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). @@ -43,7 +147,7 @@ Before you read on: [^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 1.57 or higher. Only header-only (no compiled libraries) components needed. +[^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. @@ -51,11 +155,11 @@ Before you read on: [^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 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. +[^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. 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. +[^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 may satisfy the requirement. +[^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. @@ -106,32 +210,6 @@ cmake/ COPYING src/ tests/ ... 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. -The build is structured into three parts: - -* generator - - (1) build src/bin/libint/ into generator/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. - - 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) - - if building via bare ExternalProject: - - (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 - - if building via FetchContent: - - must build libint-library-export target before library *build* targets appear ----------------------------------------------------------------------------- # configuring libint generator @@ -139,7 +217,7 @@ The build is structured into three parts: These are the most useful configure options: * Notes - * Codes "G", "L", or "GL" for each option indicate whether it is consumed by the generator, the library, or both. + * Codes "G", "L", or "C" for each option indicate whether it is consumed by the generator, the library, the library consumer, 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. @@ -235,9 +313,29 @@ These are the most useful configure options: * `CMAKE_INSTALL_DATADIR` — L — Directory to which data files are installed. Standard CMake variable. [Default=share] * `LIBINT2_INSTALL_CMAKEDIR` — L — Directory to which CMake files are installed. [Default=lib/cmake/libint2] * `LIBINT2_INSTALL_BASISDIR` — L — Directory to which data (basis) files are installed. basis/ directory created within this. [Default=share/libint/] +* `LIBINT2_INSTALL_FMODDIR — L — Directory to which Fortran module files are installed if `ENABLE_FORTRAN=ON`. [Default=include/libint2/fortran2/modules] + +* `BUILD_TESTING` — G, L — Whether to build the testing infrastructure and define the `check` target. Standard CMake variable. [Default=ON] +* `ENABLE_MPFR` — L — Use MPFR library to test Libint integrals in high precision (requires MPFR; experts only). [Default=OFF] + + +BUILD_SHARED_LIBS — L — Build Libint library as shared, not static. [Default=OFF] +LIBINT2_BUILD_SHARED_AND_STATIC_LIBS — L — Build both shared and static Libint libraries in one shot. Uses `-fPIC`. [Default=OFF] + + -D CMAKE_PREFIX_PATH="/psi/toolchainconda/envs/singleboost;/psi/toolchainconda/envs/singlegmp;/psi/toolchainconda/envs/singleeigen" \ + +# Libint2_DIR - CMake variable, set to directory containing this Config file +# CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package + +* `REQUIRE_CXX_API` — L — Build C++11 Libint API. Define header-only library target and check target (requires Eigen3). [Default=ON] +* `REQUIRE_CXX_API_COMPILED` — L — Build C++11 Libint API. Define compiled (not just header-only) targets (requires Eigen3). [Default=ON] +* `ENABLE_FORTRAN` — L — Build Fortran03+ bindings (requires C and Fortran compilers and Python). [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] +* `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] + + -* `BUILD_TESTING` — GL — Whether to build the testing infrastructure and define the `check` target. Standard CMake variable. [Default=ON] -* `ENABLE_MPFR` — L — Use MPFR dependency to test Libint integrals in high precision. [Default=OFF] ## GNU Autotools Update Guide @@ -330,10 +428,31 @@ These are the most useful configure options: * 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 + +----------------------------------------------------------------------------- -## program-specific notes +# Platform-Specific Notes -#### mpqc4 +## 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: @@ -347,7 +466,7 @@ These are the most useful configure options: --enable-eri=0 --with-max-am=7 --with-opt-am=4 --disable-unrolling --enable-generic-code --enable-contracted-ints ``` -#### gamess +### gamess * standard libtool configuration: @@ -355,7 +474,7 @@ These are the most useful configure options: --enable-eri=0 --with-max-am=7 --with-opt-am=4 --disable-unrolling --enable-generic-code --enable-contracted-ints --with-cartgauss-ordering=gamess ``` -#### orca +### orca * a libint library (version 2.0.2) is embedded in ORCA * standard libtool configuration: @@ -364,7 +483,7 @@ These are the most useful configure options: --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 +### bagel * standard libtool configuration: @@ -376,7 +495,7 @@ These are the most useful configure options: * 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 +### psi4 * production CMake configuration: @@ -392,8 +511,12 @@ These are the most useful configure options: * see [notes](https://github.com/psi4/psi4/blob/master/external/upstream/libint2/CMakeLists.txt) for details of Psi4/Libint2 configuration - -DDISABLE_ONEBODY_PROPERTY_DERIVS=OFF \ - -DENABLE_G12=1 \ - -DWITH_G12_MAX_AM=4 \ - -DWITH_G12_OPT_AM=3 \ +* Psi4 near-future configuration additions: + + ``` + -DDISABLE_ONEBODY_PROPERTY_DERIVS=OFF + -DENABLE_G12=1 + -DWITH_G12_MAX_AM=4 + -DWITH_G12_OPT_AM=3 + ``` From d85a0eccd7847a17ff1df74eb0ce7a16140ec08b Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Tue, 15 Feb 2022 01:19:02 -0500 Subject: [PATCH 177/182] docs --- INSTALL.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 4f88580f9..5b1aaca35 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -313,14 +313,14 @@ These are the most useful configure options: * `CMAKE_INSTALL_DATADIR` — L — Directory to which data files are installed. Standard CMake variable. [Default=share] * `LIBINT2_INSTALL_CMAKEDIR` — L — Directory to which CMake files are installed. [Default=lib/cmake/libint2] * `LIBINT2_INSTALL_BASISDIR` — L — Directory to which data (basis) files are installed. basis/ directory created within this. [Default=share/libint/] -* `LIBINT2_INSTALL_FMODDIR — L — Directory to which Fortran module files are installed if `ENABLE_FORTRAN=ON`. [Default=include/libint2/fortran2/modules] +* `LIBINT2_INSTALL_FMODDIR` — L — Directory to which Fortran module files are installed if `ENABLE_FORTRAN=ON`. [Default=include/libint2/fortran2/modules] * `BUILD_TESTING` — G, L — Whether to build the testing infrastructure and define the `check` target. Standard CMake variable. [Default=ON] * `ENABLE_MPFR` — L — Use MPFR library to test Libint integrals in high precision (requires MPFR; experts only). [Default=OFF] -BUILD_SHARED_LIBS — L — Build Libint library as shared, not static. [Default=OFF] -LIBINT2_BUILD_SHARED_AND_STATIC_LIBS — L — Build both shared and static Libint libraries in one shot. Uses `-fPIC`. [Default=OFF] +* `BUILD_SHARED_LIBS` — L — Build Libint library as shared, not static. [Default=OFF] +* `LIBINT2_BUILD_SHARED_AND_STATIC_LIBS` — L — Build both shared and static Libint libraries in one shot. Uses `-fPIC`. [Default=OFF] -D CMAKE_PREFIX_PATH="/psi/toolchainconda/envs/singleboost;/psi/toolchainconda/envs/singlegmp;/psi/toolchainconda/envs/singleeigen" \ From 28428b1474c0dbfc842f9e68a527deef192483dd Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 16 Feb 2022 01:41:32 -0500 Subject: [PATCH 178/182] more docs, xhost, libint2_realtype --- CMakeLists.txt | 12 ++--- INSTALL.md | 78 ++++++++++++++++++++-------- cmake/modules/xhost.cmake | 24 +++++++++ src/lib/libint/CMakeLists.txt | 7 +++ src/lib/libint/CMakeLists.txt.export | 6 +-- src/lib/libint/populate.cmake | 3 +- 6 files changed, 96 insertions(+), 34 deletions(-) create mode 100644 cmake/modules/xhost.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e68cef06..7570380e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,8 @@ option_with_print(ENABLE_T1G12_SUPPORT 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, ...) @@ -205,14 +206,13 @@ 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_print(ENABLE_MPFR "Use GNU MPFR library for high-precision testing (EXPERTS ONLY)" OFF) +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}") @@ -252,8 +252,6 @@ message(STATUS "Showing option LIBINT2_INSTALL_BASISDIR: ${LIBINT2_INSTALL_BASIS #CONFIGURE libint-. #CONFIGURE --with-pkgconfigdir Specifies the location to put pkg-config's data #CONFIGURE file. Default is $(libdir)/pkgconfig. -#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). diff --git a/INSTALL.md b/INSTALL.md index 5b1aaca35..348c7dfb9 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -17,23 +17,23 @@ Copyright (C) 2004-2022 Edward F. Valeev Before you read on: -* If you want a pre-build libint library, packages may be available: +* 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 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 - * _read on_ if you need compilation directions, skipping the compiler/generation parts. + * read on if you need compilation directions, 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_. + * if you do need to generate a custom library, read on. ----------------------------------------------------------------------------- @@ -56,8 +56,8 @@ The Libint build is structured into three parts: - 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/ + 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 @@ -87,7 +87,6 @@ The Libint build is structured into three parts: Eigen3_ROOT to prefix when cmake in place EIGEN3_INCLUDE_DIR? - -D CMAKE_PREFIX_PATH="/psi/toolchainconda/envs/singleboost;/psi/toolchainconda/envs/singlegmp;/psi/toolchainconda/envs/singleeigen" \ * Hint dependency locations all at the same installation prefix: @@ -105,14 +104,17 @@ EIGEN3_INCLUDE_DIR? * Hint dependency locations targeted by package: ``` - -D ???_ROOT="/home/miniconda/envs/onlyboost" - -D ???_ROOT="/home/miniconda/envs/onlygmp" + -D BOOST_ROOT="/home/miniconda/envs/onlyboost" + -D Multiprecision_ROOT="/home/miniconda/envs/onlygmp" -D Eigen3_ROOT="/home/miniconda/envs/onlyeigen" ``` -* -# Libint2_DIR - CMake variable, set to directory containing this Config file -# CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package +Libint2_DIR - CMake variable, set to directory containing this Config file +* `CMAKE_PREFIX_PATH` — G L — CMake variable, set to root directory of this package [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html) +* `BOOST_ROOT` — G L — +* `Multiprecision_ROOT` — G L — +* `Eigen3_ROOT` — L — + ******************************* @@ -278,7 +280,7 @@ These are the most useful configure options: * high MAX_AM generating >20k files may require `ulimit -s 65535` for linking library target on Linux to avert "ld: Argument list too long" -* `WITH_MAX_AM` — G — Support Gaussians of angular momentum up to N. Can specify values for each derivative level as a semicolon-separated string. [Default=4] +* `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] @@ -315,26 +317,56 @@ These are the most useful configure options: * `LIBINT2_INSTALL_BASISDIR` — L — Directory to which data (basis) files are installed. basis/ directory created within this. [Default=share/libint/] * `LIBINT2_INSTALL_FMODDIR` — L — Directory to which Fortran module files are installed if `ENABLE_FORTRAN=ON`. [Default=include/libint2/fortran2/modules] -* `BUILD_TESTING` — G, L — Whether to build the testing infrastructure and define the `check` target. Standard CMake variable. [Default=ON] +* `BUILD_TESTING` — G L — Whether to build the testing infrastructure and define the `check` target. Standard CMake variable. [Default=ON] * `ENABLE_MPFR` — L — Use MPFR library to test Libint integrals in high precision (requires MPFR; experts only). [Default=OFF] * `BUILD_SHARED_LIBS` — L — Build Libint library as shared, not static. [Default=OFF] * `LIBINT2_BUILD_SHARED_AND_STATIC_LIBS` — L — Build both shared and static Libint libraries in one shot. Uses `-fPIC`. [Default=OFF] - -D CMAKE_PREFIX_PATH="/psi/toolchainconda/envs/singleboost;/psi/toolchainconda/envs/singlegmp;/psi/toolchainconda/envs/singleeigen" \ - -# Libint2_DIR - CMake variable, set to directory containing this Config file -# CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package - -* `REQUIRE_CXX_API` — L — Build C++11 Libint API. Define header-only library target and check target (requires Eigen3). [Default=ON] -* `REQUIRE_CXX_API_COMPILED` — L — Build C++11 Libint API. Define compiled (not just header-only) targets (requires Eigen3). [Default=ON] -* `ENABLE_FORTRAN` — L — Build Fortran03+ bindings (requires C and Fortran compilers and Python). [Default=OFF] +* `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] * `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] * `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] +* `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. +* `CMAKE_BUILD_TYPE` — G L — Customary CMake variable. [Default=Release] +* `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] +* `ENABLE_XHOST` — L — "Enables processor-specific optimization (with MSVC, it enables AVX2 instructions)" ON + + +* `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] + + +* `CMAKE_CXX_COMPILER` — G L — Specify C++ Compiler. [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html) +* `CMAKE_C_COMPILER` — G L — Specify C Compiler. [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html) +* `CMAKE_Fortran_COMPILER` — G L — Specify Fortran Compiler. [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html) +* `CMAKE_CXX_FLAGS` — G L — Specify additional user flags for C++ files. [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html) +* `CMAKE_C_FLAGS` — G L — Specify additional user flags for C files. [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html) +* `CMAKE_Fortran_FLAGS` — G L — Specify additional user flags for Fortran files. [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html) +* `CMAKE_INSTALL_PREFIX` — L — Specify directory into which library installed. [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html) ## GNU Autotools Update Guide @@ -402,6 +434,8 @@ These are the most useful configure options: * `--with-cmakedir=partialpath` --> `-D LIBINT2_INSTALL_CMAKEDIR=partialpath` +* `--with-real-type=type` --> `-D LIBINT2_REALTYPE=type` + ## Targets * `libint2` --> `Libint2::int2` diff --git a/cmake/modules/xhost.cmake b/cmake/modules/xhost.cmake new file mode 100644 index 000000000..d4d4cbf05 --- /dev/null +++ b/cmake/modules/xhost.cmake @@ -0,0 +1,24 @@ +message("CMAKE_CXX_COMPILER_ID ${CMAKE_CXX_COMPILER_ID}") +# 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/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index 9af9a398b..25a085bad 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -97,6 +97,8 @@ else() -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 @@ -113,6 +115,11 @@ else() "-DEigen3_DIR=${Eigen3_DIR}" ) endif() + if (Eigen3_ROOT) + list(APPEND library_CMAKE_ARGS + "-DEigen3_ROOT=${Eigen3_ROOT}" + ) + endif() if (LIBINT_LOCAL_Eigen3_INSTALL) list(APPEND library_CMAKE_ARGS "-DLIBINT_LOCAL_Eigen3_INSTALL=${LIBINT_LOCAL_Eigen3_INSTALL}" diff --git a/src/lib/libint/CMakeLists.txt.export b/src/lib/libint/CMakeLists.txt.export index a977e523d..0248cc005 100644 --- a/src/lib/libint/CMakeLists.txt.export +++ b/src/lib/libint/CMakeLists.txt.export @@ -42,15 +42,13 @@ option_with_print(ENABLE_MPFR "Use GNU MPFR library for high-precision testing ( 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 (NOT LIBINT2_REALTYPE) - set(LIBINT2_REALTYPE double) -endif() - if(ENABLE_FORTRAN) include(CheckLanguage) check_language(Fortran) diff --git a/src/lib/libint/populate.cmake b/src/lib/libint/populate.cmake index 2cbd8bde4..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" @@ -55,6 +55,7 @@ file(INSTALL "${PROJECT_SOURCE_DIR}/cmake/modules/autocmake_safeguards.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" From 3be4f6f7ce9119d47cc5f429d99a4bdf97eedfa7 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Wed, 16 Feb 2022 12:21:55 -0500 Subject: [PATCH 179/182] more docs --- INSTALL.md | 261 ++++++++++++++++++++++++----------------------------- README.md | 10 +- 2 files changed, 126 insertions(+), 145 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 348c7dfb9..a6cec0332 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,18 +1,3 @@ -# 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) -- master status: [![Build Status](https://travis-ci.org/evaleev/libint.svg?branch=master)](https://travis-ci.org/evaleev/libint) -- project page: http://libint.valeyev.net/ -- e-mail - libint@valeyev.net - -See [the INSTALL.md file](INSTALL.md) for installation instructions and links to usage instructions. - -Copyright (C) 2004-2022 Edward F. Valeev - ------------------------------------------------------------------------------ - # Libint Compiler vs Library Before you read on: @@ -27,13 +12,14 @@ Before you read on: * 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 - * read on if you need compilation directions, skipping the compiler/generation parts. + * 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. + * if you do need to generate a custom library, _read on_. + ----------------------------------------------------------------------------- @@ -64,60 +50,35 @@ The Libint build is structured into three parts: - (5) optionally testable - (6) install into CMAKE_INSTALL_PREFIX ------------------------------------------------------------------------------ - - ------------------------------------------------------------------------------ - - ------------------------------------------------------------------------------ +Command-line synopsis. See table below for `--target` choices and [section](#Configuring-Libint) for `-D options` choices. ------------------------------------------------------------------------------ - +```bash +>>> 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` +``` ------------------------------------------------------------------------------ +| `--target ...` | incl. | steps | ( | see | below | ) | +| -------------- | ----- | ----- | ----- | ----- | ----- | ----- | +| `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. ----------------------------------------------------------------------------- - -Eigen3_ROOT to prefix when cmake in place -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" - ``` - -Libint2_DIR - CMake variable, set to directory containing this Config file -* `CMAKE_PREFIX_PATH` — G L — CMake variable, set to root directory of this package [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html) -* `BOOST_ROOT` — G L — -* `Multiprecision_ROOT` — G L — -* `Eigen3_ROOT` — L — - - -******************************* - # Prerequisites | Task | Compilers | CMake[^3] | CMake generator[^20] | Py | Boost[^7] | Eigen | GMPXX[^13] | MPFR[^14] | @@ -171,52 +132,10 @@ Libint2_DIR - CMake variable, set to directory containing this Config file [^22]: Python used to process files for Fortran binding. -# Synopsis - -- 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` - - -For (more) complete instructions please refer to https://github.com/evaleev/libint/wiki - - - - -CMake build overview: - -```bash ->>> ls -cmake/ COPYING src/ tests/ ... ->>> cmake -S. -Bbuild -GNinja -DCMAKE_INSTALL_PREFIX=/path/to/future/install-libint ... -... --- Generating done --- Build files have been written to: /current/dir/build ->>> cmake --build build --target install -j`getconf _NPROCESSORS_ONLN` -``` - - -| `--target ...` | incl. | steps | ( | see | below | ) | -| -------------- | ----- | ----- | ----- | ----- | ----- | ----- | -| `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. - - ----------------------------------------------------------------------------- -# configuring libint generator -These are the most useful configure options: +# Configuring Libint * Notes * Codes "G", "L", or "C" for each option indicate whether it is consumed by the generator, the library, the library consumer, or a combination. @@ -224,6 +143,7 @@ These are the most useful configure options: * 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] @@ -239,18 +159,18 @@ These are the most useful configure options: * `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 Convention +### Which Ordering Conventions -* `LIBINT2_SHGAUSS_ORDERING` — L — Ordering for shells of solid harmonic Gaussians. Consumed at library build-time. [Default=standard] +* `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. Consumed at generator build-time. [Default=standard] +* `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. Consumed at generator build-time. [Default=standard] +* `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), @@ -268,6 +188,7 @@ These are the most useful configure options: * `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 @@ -278,7 +199,7 @@ These are the most useful configure options: -- 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" + * 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`] @@ -304,32 +225,97 @@ These are the most useful configure options: * `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`] -### Miscellaneous +### 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_BINDIR` — L — Directory to which executables and runtime libraries are installed. Standard CMake variable. [Default=bin] -* `CMAKE_INSTALL_LIBDIR` — L — Directory to which libraries are installed. Standard CMake variable. [Default=lib] -* `CMAKE_INSTALL_INCLUDEDIR` — L — Directory to which headers are installed. Standard CMake variable. [Default=include] -* `CMAKE_INSTALL_DATADIR` — L — Directory to which data files are installed. Standard CMake variable. [Default=share] -* `LIBINT2_INSTALL_CMAKEDIR` — L — Directory to which CMake files are installed. [Default=lib/cmake/libint2] -* `LIBINT2_INSTALL_BASISDIR` — L — Directory to which data (basis) files are installed. basis/ directory created within this. [Default=share/libint/] -* `LIBINT2_INSTALL_FMODDIR` — L — Directory to which Fortran module files are installed if `ENABLE_FORTRAN=ON`. [Default=include/libint2/fortran2/modules] +* `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. [Default=bin] +* `CMAKE_INSTALL_LIBDIR` — L — Directory within `CMAKE_INSTALL_PREFIX` to which libraries are installed. Standard CMake variable. [Default=lib] +* `CMAKE_INSTALL_INCLUDEDIR` — L — Directory within `CMAKE_INSTALL_PREFIX` to which headers are installed. Standard CMake variable. [Default=include] +* `CMAKE_INSTALL_DATADIR` — L — Directory within `CMAKE_INSTALL_PREFIX` to which data files are installed. Standard CMake variable. [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] -* `BUILD_TESTING` — G L — Whether to build the testing infrastructure and define the `check` target. Standard CMake variable. [Default=ON] -* `ENABLE_MPFR` — L — Use MPFR library to test Libint integrals in high precision (requires MPFR; experts only). [Default=OFF] +### Detecting Dependencies -* `BUILD_SHARED_LIBS` — L — Build Libint library as shared, not static. [Default=OFF] -* `LIBINT2_BUILD_SHARED_AND_STATIC_LIBS` — L — Build both shared and static Libint libraries in one shot. Uses `-fPIC`. [Default=OFF] +* `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): UNTESTED + + ``` + -D _DIR="/home/miniconda/envs/onlyeigen/share/eigen3/cmake/Eigen3Config.cmake" + -D _DIR="/home/miniconda/envs/onlyboost/lib/cmake/Boost-1.73.0/BoostConfig.cmake" + ``` + +* 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] -* `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] + + +### 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: @@ -345,11 +331,6 @@ These are the most useful configure options: **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. -* `CMAKE_BUILD_TYPE` — G L — Customary CMake variable. [Default=Release] -* `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] -* `ENABLE_XHOST` — L — "Enables processor-specific optimization (with MSVC, it enables AVX2 instructions)" ON - - * `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] @@ -360,16 +341,9 @@ These are the most useful configure options: * `LIBINT_ENABLE_GENERIC_CODE` — G — Use manually-written generic code. [Default=OFF] -* `CMAKE_CXX_COMPILER` — G L — Specify C++ Compiler. [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html) -* `CMAKE_C_COMPILER` — G L — Specify C Compiler. [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html) -* `CMAKE_Fortran_COMPILER` — G L — Specify Fortran Compiler. [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html) -* `CMAKE_CXX_FLAGS` — G L — Specify additional user flags for C++ files. [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html) -* `CMAKE_C_FLAGS` — G L — Specify additional user flags for C files. [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html) -* `CMAKE_Fortran_FLAGS` — G L — Specify additional user flags for Fortran files. [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html) -* `CMAKE_INSTALL_PREFIX` — L — Specify directory into which library installed. [Customary CMake variable.](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html) - +----------------------------------------------------------------------------- -## GNU Autotools Update Guide +# 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 @@ -436,12 +410,13 @@ These are the most useful configure options: * `--with-real-type=type` --> `-D LIBINT2_REALTYPE=type` -## Targets +* `libint2` --> `Libint2::int2` (target) +* `libint2_cxx` --> `Libint2::cxx` (target) - * `libint2` --> `Libint2::int2` - * `libint2_cxx` --> `Libint2::cxx` +----------------------------------------------------------------------------- +# Targets | Namespaced Target[^15] | Component[^16] | Built by Default | Ensure Built | Ensure Excluded | Internal Target(s)[^17] | Alias[^18] | | ---------------------- | -------------- | ---------------- | ----------------------------- | ----------------------------------------- | ----------------------------------- | ------------ | @@ -457,6 +432,8 @@ These are the most useful configure options: [^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 @@ -464,6 +441,7 @@ These are the most useful configure options: 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 @@ -482,6 +460,7 @@ These are the most useful configure options: * 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 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 From 0768dbb6594f11c0fa77916b016185fde2557ce5 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 17 Feb 2022 02:35:03 -0500 Subject: [PATCH 180/182] more docs and eigen --- INSTALL.md | 67 ++++++++++++++++++++++++++-------- cmake/modules/FindEigen3.cmake | 5 ++- cmake/modules/xhost.cmake | 1 - src/lib/libint/CMakeLists.txt | 10 +++++ 4 files changed, 64 insertions(+), 19 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index a6cec0332..aca8a3e85 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -36,7 +36,8 @@ The Libint build is structured into three parts: - (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. + 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 @@ -51,9 +52,10 @@ The Libint build is structured into three parts: - (6) install into CMAKE_INSTALL_PREFIX -Command-line synopsis. See table below for `--target` choices and [section](#Configuring-Libint) for `-D options` choices. +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 ... @@ -63,8 +65,9 @@ cmake/ COPYING src/ tests/ ... >>> cmake --build build --target install -j`getconf _NPROCESSORS_ONLN` ``` +### Build Targets -| `--target ...` | incl. | steps | ( | see | below | ) | +| `--target ...` | incl. | steps | ( | see | above | ) | | -------------- | ----- | ----- | ----- | ----- | ----- | ----- | | `build_libint` | 1 | - | - | - | - | - | | `check-libint2compiler` | 1 | 2 | - | - | - | - | @@ -283,11 +286,11 @@ EIGEN3_INCLUDE_DIR? -D Eigen3_ROOT="/home/miniconda/envs/onlyeigen" ``` -* Hint dependency locations targeted by Config.cmake (most CMake-like): UNTESTED +* Hint dependency locations targeted by Config.cmake (most CMake-like): ``` - -D _DIR="/home/miniconda/envs/onlyeigen/share/eigen3/cmake/Eigen3Config.cmake" - -D _DIR="/home/miniconda/envs/onlyboost/lib/cmake/Boost-1.73.0/BoostConfig.cmake" + -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 @@ -400,23 +403,32 @@ EIGEN3_INCLUDE_DIR? * `--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 ENABLE_CXX11API=ON` --> `-D REQUIRE_CXX_API=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` -* `libint2` --> `Libint2::int2` (target) -* `libint2_cxx` --> `Libint2::cxx` (target) +* (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` ----------------------------------------------------------------------------- -# Targets +# 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] | | ---------------------- | -------------- | ---------------- | ----------------------------- | ----------------------------------------- | ----------------------------------- | ------------ | @@ -446,15 +458,15 @@ EIGEN3_INCLUDE_DIR? # Platform-Specific Notes -## Linux +### Linux -## macOS +### 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 +### 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 @@ -533,3 +545,26 @@ EIGEN3_INCLUDE_DIR? -DWITH_G12_OPT_AM=3 ``` +# Misc. 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/cmake/modules/FindEigen3.cmake b/cmake/modules/FindEigen3.cmake index 7ebac9f42..2a9c9357b 100644 --- a/cmake/modules/FindEigen3.cmake +++ b/cmake/modules/FindEigen3.cmake @@ -5,6 +5,7 @@ # * 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 # @@ -35,10 +36,10 @@ if(NOT Eigen3_FIND_VERSION) if(NOT Eigen3_FIND_VERSION_MAJOR) - set(Eigen3_FIND_VERSION_MAJOR 2) + set(Eigen3_FIND_VERSION_MAJOR 3) endif() if(NOT Eigen3_FIND_VERSION_MINOR) - set(Eigen3_FIND_VERSION_MINOR 91) + set(Eigen3_FIND_VERSION_MINOR 0) endif() if(NOT Eigen3_FIND_VERSION_PATCH) set(Eigen3_FIND_VERSION_PATCH 0) diff --git a/cmake/modules/xhost.cmake b/cmake/modules/xhost.cmake index d4d4cbf05..9118c0559 100644 --- a/cmake/modules/xhost.cmake +++ b/cmake/modules/xhost.cmake @@ -1,4 +1,3 @@ -message("CMAKE_CXX_COMPILER_ID ${CMAKE_CXX_COMPILER_ID}") # 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") diff --git a/src/lib/libint/CMakeLists.txt b/src/lib/libint/CMakeLists.txt index 25a085bad..51f8cd172 100644 --- a/src/lib/libint/CMakeLists.txt +++ b/src/lib/libint/CMakeLists.txt @@ -120,6 +120,16 @@ else() "-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 "-DLIBINT_LOCAL_Eigen3_INSTALL=${LIBINT_LOCAL_Eigen3_INSTALL}" From 57f86ca2daac6f2c88b79cc352632f3ea07750da Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Thu, 17 Feb 2022 14:12:56 -0500 Subject: [PATCH 181/182] typo --- include/libint2/boys.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 9f12ee61e1ce52420fe3020712c3584cb3e9a1b4 Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Thu, 17 Feb 2022 15:44:37 -0500 Subject: [PATCH 182/182] docs edits --- INSTALL.md | 72 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 23 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index aca8a3e85..7c42d1618 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -141,7 +141,7 @@ Use combined targets like `cmake --target check install` to avoid some unnecessa # Configuring Libint * Notes - * Codes "G", "L", or "C" for each option indicate whether it is consumed by the generator, the library, the library consumer, or a combination. + * 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. @@ -230,12 +230,12 @@ Use combined targets like `cmake --target check install` to avoid some unnecessa ### 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) +* `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 @@ -243,11 +243,11 @@ Use combined targets like `cmake --target check install` to avoid some unnecessa * 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. [Default=bin] -* `CMAKE_INSTALL_LIBDIR` — L — Directory within `CMAKE_INSTALL_PREFIX` to which libraries are installed. Standard CMake variable. [Default=lib] -* `CMAKE_INSTALL_INCLUDEDIR` — L — Directory within `CMAKE_INSTALL_PREFIX` to which headers are installed. Standard CMake variable. [Default=include] -* `CMAKE_INSTALL_DATADIR` — L — Directory within `CMAKE_INSTALL_PREFIX` to which data files are installed. Standard CMake variable. [Default=share] +* `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] @@ -256,7 +256,7 @@ Use combined targets like `cmake --target check install` to avoid some unnecessa ### 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) +* `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) @@ -310,11 +310,11 @@ EIGEN3_INCLUDE_DIR? ### 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] +* `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] +* `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] @@ -525,13 +525,36 @@ EIGEN3_INCLUDE_DIR? * production CMake configuration: ``` - -DREQUIRE_CXX_API=ON -DLIBINT2_SHGAUSS_ORDERING=gaussian -DLIBINT2_CARTGAUSS_ORDERING=standard -DLIBINT2_SHELL_SET=standard -DENABLE_ERI=2 -DENABLE_ERI3=2 -DENABLE_ERI2=2 -DENABLE_ONEBODY=2 -DMULTIPOLE_MAX_ORDER=4 -DWITH_MAX_AM="6;5;4" -DWITH_ERI_MAX_AM="5;4;3" -DWITH_ERI3_MAX_AM="6;5;4" -DWITH_ERI2_MAX_AM="6;5;4" -DERI3_PURE_SH=OFF -DERI2_PURE_SH=OFF + -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 gss CXX_ho impure_sh eri_c4_d0_l3 eri_c4_d1_l2 eri_c4_d2_l2 eri_c3_d0_l4 eri_c3_d1_l3 eri_c3_d2_l3 eri_c2_d0_l4 eri_c2_d1_l3 eri_c2_d2_l3 onebody_d0_l4 onebody_d1_l3 onebody_d2_l3) + 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 @@ -545,25 +568,28 @@ EIGEN3_INCLUDE_DIR? -DWITH_G12_OPT_AM=3 ``` -# Misc. Questions -##### Where do I get the source code? +----------------------------------------------------------------------------- + +# 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? +#### 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? +#### 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? +#### 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.