diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a1700cba..efcf91e57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,13 +65,12 @@ include(CTest) # defines BUILD_TESTING option # <<< General >>> -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) +### 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) -if(NOT REQUIRE_CXX_API) - message(FATAL_ERROR "The plain library without C++11 API is not hooked into this pure-CMake Libint2 buildsystem. For immediate use, switch to the original Libtool+CMake buildsystem. For help expanding this buildsystem to the plain library, raise an issue on GitHub and ping @loriab.") -endif() +### 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(ENABLE_FORTRAN "Build Fortran03+ Libint interface (requires Fortran)" OFF) # <<< Which Integrals Classes, Which Derivative Levels >>> @@ -137,14 +136,15 @@ option_with_default(WITH_MAX_AM Can specify values for each derivative levels 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}") 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-e ints for Gaussians of angular momentum up to N. + "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) option_with_default(WITH_ONEBODY_OPT_AM - "Optimize 1-e ints maximally for up to angular momentum N (N <= max-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) option_with_default(WITH_ERI_MAX_AM diff --git a/cmake/libint2-config.cmake.in b/cmake/libint2-config.cmake.in index 0bce93a91..bd9962acc 100644 --- a/cmake/libint2-config.cmake.in +++ b/cmake/libint2-config.cmake.in @@ -22,38 +22,21 @@ # shared - search for only shared library # static - search for only static library # -# e[2, 8] - search for library including energy ERI integrals with angular momentum >= this integer -# g[2, 8] - search for library including gradient ERI integrals with angular momentum >= this integer -# h[2, 8] - search for library including Hessian ERI integrals with angular momentum >= this integer -# eri2_e[2, 8] - search for library including energy ERI2 integrals with angular momentum >= this integer -# eri2_g[2, 8] - search for library including gradient ERI2 integrals with angular momentum >= this integer -# eri2_h[2, 8] - search for library including Hessian ERI2 integrals with angular momentum >= this integer -# eri3_e[2, 8] - search for library including energy ERI2 integrals with angular momentum >= this integer -# eri3_g[2, 8] - search for library including gradient ERI2 integrals with angular momentum >= this integer -# eri3_h[2, 8] - search for library including Hessian ERI2 integrals with angular momentum >= this integer -# -# sph cart shell_set used_by -# -------- -------- --------- ------- -# sss - search for standard + standard + standard = mpqc4 -# sso - search for + orca -# sis - search for + intv3 + standard -# 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 -# 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 +# 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) +# twobody_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 # # # Exported targets: @@ -72,7 +55,7 @@ # :: # # find_package(Libint2) -# find_package(Libint2 2.7.0 CONFIG REQUIRED COMPONENTS shared gss e5 g5) +# find_package(Libint2 2.7.0 CONFIG REQUIRED COMPONENTS shared ss twobody_c4_d0_l5 twobody_c4_d1_l4) # # # The following variables can be set to guide the search for this package: @@ -94,92 +77,35 @@ set (_valid_components static shared - e2 - e3 - e4 - e5 - e6 - e7 - e8 - g2 - g3 - g4 - g5 - g6 - g7 - g8 - h2 - h3 - h4 - h5 - h6 - h7 - h8 - - eri2_e2 - eri2_e3 - eri2_e4 - eri2_e5 - eri2_e6 - eri2_e7 - eri2_e8 - eri2_g2 - eri2_g3 - eri2_g4 - eri2_g5 - eri2_g6 - eri2_g7 - eri2_g8 - eri2_h2 - eri2_h3 - eri2_h4 - eri2_h5 - eri2_h6 - eri2_h7 - eri2_h8 - - eri3_e2 - eri3_e3 - eri3_e4 - eri3_e5 - eri3_e6 - eri3_e7 - eri3_e8 - eri3_g2 - eri3_g3 - eri3_g4 - eri3_g5 - eri3_g6 - eri3_g7 - eri3_g8 - eri3_h2 - eri3_h3 - eri3_h4 - eri3_h5 - eri3_h6 - eri3_h7 - eri3_h8 - - sss - sso - sis - sio - sgs - sgo - sos - soo - sbs - sbo - gss - gso - gis - gio - ggs - ggo - gos - goo - gbs - gbo + twobody_c4_d0_l2 + twobody_c4_d0_l3 + twobody_c4_d0_l4 + twobody_c4_d0_l5 + twobody_c4_d0_l6 + twobody_c4_d0_l7 + twobody_c4_d0_l8 + twobody_c4_d0_l9 + twobody_c4_d0_l10 + twobody_c4_d1_l2 + twobody_c4_d1_l3 + twobody_c4_d1_l4 + twobody_c4_d1_l5 + twobody_c4_d1_l6 + twobody_c4_d1_l7 + twobody_c4_d1_l8 + twobody_c4_d1_l9 + twobody_c4_d1_l10 + + ss + so + is + io + gs + go + os + oo + bs + bo ) # check library style component @@ -194,6 +120,7 @@ list(FIND ${PN}_FIND_COMPONENTS "static" _seek_static) # check AM & derivative component set(${PN}_MAX_AM_ERI @Libint2_MAX_AM_ERI@) +set(${PN}_MAX_AM_TWOBODY4 @Libint2_MAX_AM_TWOBODY4@) foreach(_eri @Libint2_ERI_COMPONENTS@) set(${PN}_${_eri}_FOUND 1) endforeach() diff --git a/cmake/modules/int_am.cmake b/cmake/modules/int_am.cmake index 257ff8264..c7b35a400 100644 --- a/cmake/modules/int_am.cmake +++ b/cmake/modules/int_am.cmake @@ -1,11 +1,11 @@ # handle the defaulting and setting of the following variables -# * ENABLE_[ONEBODY|ERI|ERI2|ERI3|G12|G12DKH] -# * [LIBINT|ONEBODY|ERI|ERI2|ERI3|G12|G12DKH]_[MAX|OPT]_AM[|_LIST] +# * ENABLE_[ONEBODY|TWOBODY2|TWOBODY3|TWOBODY4|G12|G12DKH] +# * [LIBINT|ONEBODY|TWOBODY2|TWOBODY3|TWOBODY4|G12|G12DKH]_[MAX|OPT]_AM[|_LIST] # * LIBINT_ONEBODY_DERIV # * LIBINT_SUPPORTS_ONEBODY # _candidate variables not needed for config.h but are used to figure -# out the energy/gradient/hessian ERI AM levels at the CMake level +# 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)` @@ -15,47 +15,72 @@ message(STATUS "Processing integrals classes ...") # <<< overall defaults (LIBINT_MAX/OPT_AM) >>> -list(LENGTH WITH_MAX_AM _lam) -if (_lam GREATER 1) - list(GET WITH_MAX_AM 0 _candidate0_E) - list(GET WITH_MAX_AM 1 _candidate0_G) - if (_lam GREATER 2) - list(GET WITH_MAX_AM 2 _candidate0_H) - else() - set(_candidate0_H "-1") - endif() +message(STATUS "WITH_MAX_AM=${WITH_MAX_AM}") +list(LENGTH WITH_MAX_AM _ntokens) +if (_ntokens GREATER 1) + + 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} _candidate0_d${_d}) + if (${_candidate0_d${_d}} GREATER _max_am) + set(_max_am ${_candidate0_d${_d}}) + endif() + endforeach() list(JOIN WITH_MAX_AM "," _sam) - execute_process (COMMAND bash -c "echo ${_sam} | tr , '\n' | sort -n | tail -n1" - OUTPUT_VARIABLE _max_LIBINT_MAX_AM) - set(LIBINT_MAX_AM_LIST ${_sam}) - set(LIBINT_MAX_AM ${_max_LIBINT_MAX_AM}) # only overall LIBINT, not specific integrals classes, sets both MAX_AM & MAX_AM_LIST + set(LIBINT_MAX_AM ${_max_am}) # only overall LIBINT, not specific integrals classes, sets both MAX_AM & MAX_AM_LIST else() - set(_candidate0_E ${WITH_MAX_AM}) - set(_candidate0_G "-1") - set(_candidate0_H "-1") + set(_given_max_am_list FALSE) + set(_candidate0_d0 ${WITH_MAX_AM}) set(LIBINT_MAX_AM_LIST "") set(LIBINT_MAX_AM ${WITH_MAX_AM}) set(_max_LIBINT_MAX_AM ${LIBINT_MAX_AM}) if (LIBINT_MAX_AM GREATER_EQUAL 8) - message(FATAL "Value for LIBINT_MAX_AM too high (${LIBINT_MAX_AM}). Are you sure you know what you are doing?") + 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}).") endif() endif() -list(LENGTH WITH_OPT_AM _lam) -if (_lam GREATER 1) - list(JOIN WITH_OPT_AM "," _sam) - execute_process (COMMAND bash -c "echo ${_sam} | tr , '\n' | sort -n | tail -n1" - OUTPUT_VARIABLE _max_LIBINT_OPT_AM) +message(STATUS "LIBINT_MAX_AM_LIST=${LIBINT_MAX_AM_LIST} LIBINT_MAX_AM=${LIBINT_MAX_AM}") + +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(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() + 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() + endif() + + endforeach() + list(JOIN PROCESSED_OPT_AM_LIST "," _sam) set(LIBINT_OPT_AM_LIST ${_sam}) - set(LIBINT_OPT_AM ${_max_LIBINT_OPT_AM}) # only overall LIBINT, not specific integrals classes, sets both OPT_AM & OPT_AM_LIST + set(LIBINT_OPT_AM ${_max_opt_am}) # only overall LIBINT, not specific integrals classes, sets both OPT_AM & OPT_AM_LIST else() set(LIBINT_OPT_AM_LIST "") + message(STATUS "WITH_OPT_AM=${WITH_OPT_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") @@ -64,23 +89,18 @@ else() endif() if (LIBINT_OPT_AM GREATER _max_LIBINT_MAX_AM) - message(FATAL "Invalid value for LIBINT_OPT_AM (${LIBINT_OPT_AM} !<= ${_max_LIBINT_MAX_AM}).") + set(LIBINT_OPT_AM ${_max_LIBINT_MAX_AM}) endif() endif() +message(STATUS "LIBINT_OPT_AM_LIST=${LIBINT_OPT_AM_LIST} LIBINT_OPT_AM=${LIBINT_OPT_AM}") # <<< Macro >>> macro(process_integrals_class class) if (ENABLE_${class} GREATER_EQUAL 0) set(INCLUDE_${class} ${ENABLE_${class}}) - set(_candidate0_${class}_E ${_candidate0_E}) - if (${INCLUDE_${class}} GREATER_EQUAL 1) - set(_candidate0_${class}_G ${_candidate0_G}) - endif() - if (${INCLUDE_${class}} GREATER_EQUAL 2) - set(_candidate0_${class}_H ${_candidate0_H}) - endif() + set(_candidate0_${class}_d${INCLUDE_${class}} ${_candidate0_d${INCLUDE_${class}}}) set(LIBINT_SUPPORTS_${class} yes) set(LIBINT_${class}_DERIV ${INCLUDE_${class}}) message(STATUS "Enabling integrals class ${class} to derivative ${INCLUDE_${class}}") @@ -92,19 +112,14 @@ macro(process_integrals_class class) endif() if (ENABLE_${class} GREATER_EQUAL 0) - list(LENGTH WITH_${class}_MAX_AM _lam) - if (_lam GREATER 1) - list(GET WITH_${class}_MAX_AM 0 _candidate_${class}_E) - if (${INCLUDE_${class}} GREATER_EQUAL 1) - list(GET WITH_${class}_MAX_AM 1 _candidate_${class}_G) - endif() - if ((${INCLUDE_${class}} GREATER_EQUAL 1) AND (_lam GREATER 2)) - list(GET WITH_${class}_MAX_AM 2 _candidate_${class}_H) - endif() + 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 _candidate_${class}_d${_d}) + endforeach() list(JOIN WITH_${class}_MAX_AM "," _sam) - execute_process (COMMAND bash -c "echo ${_sam} | tr , '\n' | sort -n | tail -n1" - OUTPUT_VARIABLE _max_${class}_MAX_AM) set(${class}_MAX_AM_LIST ${_sam}) set(${class}_MAX_AM "") else() @@ -177,39 +192,25 @@ endmacro() process_integrals_class(ONEBODY) -process_integrals_class(ERI) -process_integrals_class(ERI3) -process_integrals_class(ERI2) +process_integrals_class(TWOBODY2) +process_integrals_class(TWOBODY3) +process_integrals_class(TWOBODY4) # discrepancy, as configure doesn't do AM_LIST for these process_integrals_class(G12) process_integrals_class(G12DKH) # form list of active _ strings to use in Libint2Config -set(Libint2_ERI_COMPONENTS "") -foreach(_cls ERI;ERI2;ERI3) +set(Libint2_TWOBODY_COMPONENTS "") +foreach(_cls TWOBODY2;TWOBODY3;TWOBODY4) string(TOLOWER ${_cls} _lbl) - if (${_cls} STREQUAL ERI) - set(_lbl "") - else() - set(_lbl "${_lbl}_") - endif() + set(_lbl "${_lbl}_") - if (${INCLUDE_${_cls}} GREATER_EQUAL 0) - foreach(_i RANGE 2 ${_candidate_${_cls}_E}) - list(APPEND Libint2_ERI_COMPONENTS "${_lbl}e${_i}") - endforeach() - endif() - if (${INCLUDE_${_cls}} GREATER_EQUAL 1) - foreach(_i RANGE 2 ${_candidate_${_cls}_G}) - list(APPEND Libint2_ERI_COMPONENTS "${_lbl}g${_i}") + foreach (_deriv RANGE 0 ${INCLUDE_${_cls}}) + foreach(_l RANGE 0 ${_candidate_${_cls}_d${_deriv}}) + list(APPEND Libint2_TWOBODY_COMPONENTS "${_lbl}_d${_deriv}_l${_l}") endforeach() - endif() - if (${INCLUDE_${_cls}} GREATER_EQUAL 2) - foreach(_i RANGE 2 ${_candidate_${_cls}_H}) - list(APPEND Libint2_ERI_COMPONENTS "${_lbl}h${_i}") - endforeach() - endif() + endforeach() endforeach() message(STATUS "Library will satisfy ERI AM components: ${Libint2_ERI_COMPONENTS}") diff --git a/cmake/modules/options.cmake b/cmake/modules/options.cmake index 8424ff06d..0cad735bc 100644 --- a/cmake/modules/options.cmake +++ b/cmake/modules/options.cmake @@ -44,14 +44,28 @@ endmacro(booleanize01) #NOTE2: CMAKE_BUILD_TYPE (and other CMake variables) are always defined so need # to further check for if they are the NULL string. This is also why we # need the force +#NOTE3: If option X does not start with LIBINT_ will look for LIBINT_X first; if +# not given will look for X and assign LIBINT_X to its value # #Syntax: option_with_default(