From ffc2cfb14aa3e9454799482736b6d58b37409a5d Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Wed, 13 Dec 2023 09:36:56 -0500 Subject: [PATCH 1/8] reverts the regression in https://github.com/evaleev/libint/commit/80e77340ca3ec6add798a31783de48b759fd945f that causes library build to default to non-unity --- export/cmake/CMakeLists.txt.export | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/export/cmake/CMakeLists.txt.export b/export/cmake/CMakeLists.txt.export index 482f2d01a..4b4c389a4 100644 --- a/export/cmake/CMakeLists.txt.export +++ b/export/cmake/CMakeLists.txt.export @@ -217,7 +217,7 @@ target_compile_features(libint2_obj PUBLIC "cxx_std_11") set_target_properties( libint2_obj PROPERTIES - UNITY_BUILD FALSE + UNITY_BUILD TRUE ) if (TARGET MPFR::GMPXX) target_link_libraries(libint2_obj PUBLIC MPFR::GMPXX) From 991c5fd0be58ac72e88c2177ed8ca9e4bfaee39e Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Wed, 13 Dec 2023 12:29:07 -0500 Subject: [PATCH 2/8] reverts accidental regression in https://github.com/evaleev/libint/commit/10a30a1f38b592d41e1ca915caaf1fca5323e358#diff-c199104b15fc8496b8ed49077d25d9c52220ae78b462fd9de5e840f2f1995b23L692 --- tests/hartree-fock/hartree-fock++.cc | 41 +++++++++++----------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/tests/hartree-fock/hartree-fock++.cc b/tests/hartree-fock/hartree-fock++.cc index e244f08a7..4e65e5d5a 100644 --- a/tests/hartree-fock/hartree-fock++.cc +++ b/tests/hartree-fock/hartree-fock++.cc @@ -689,6 +689,7 @@ int main(int argc, char* argv[]) { } { // compute hessian + const auto ncoords = 3 * atoms.size(); #if LIBINT2_DERIV_ONEBODY_ORDER > 1 // compute 1-e hessian Matrix H1 = Matrix::Zero(ncoords, ncoords); @@ -720,7 +721,7 @@ int main(int argc, char* argv[]) { } std::cout << "** 1-body hessian = "; - for (auto row = 0, i = 0; row != ncoords; ++row) { + for (auto row = 0; row != ncoords; ++row) { for (auto col = row; col != ncoords; ++col) { std::cout << H1(row, col) << " "; } @@ -728,7 +729,7 @@ int main(int argc, char* argv[]) { std::cout << std::endl; std::cout << "** Pulay hessian = "; - for (auto row = 0, i = 0; row != ncoords; ++row) { + for (auto row = 0; row != ncoords; ++row) { for (auto col = row; col != ncoords; ++col) { std::cout << H_Pulay(row, col) << " "; } @@ -753,7 +754,7 @@ int main(int argc, char* argv[]) { } std::cout << "** 2-body hessian = "; - for (auto row = 0, i = 0; row != ncoords; ++row) { + for (auto row = 0; row != ncoords; ++row) { for (auto col = row; col != ncoords; ++col) { std::cout << H2(row, col) << " "; } @@ -816,7 +817,7 @@ int main(int argc, char* argv[]) { } std::cout << "** nuclear repulsion hessian = "; - for (auto row = 0, i = 0; row != ncoords; ++row) { + for (auto row = 0; row != ncoords; ++row) { for (auto col = row; col != ncoords; ++col) { std::cout << HN(row, col) << " "; } @@ -825,7 +826,7 @@ int main(int argc, char* argv[]) { auto H = H1 + H_Pulay + H2 + HN; std::cout << "** Hartree-Fock hessian = "; - for (auto row = 0, i = 0; row != ncoords; ++row) { + for (auto row = 0; row != ncoords; ++row) { for (auto col = row; col != ncoords; ++col) { std::cout << H(row, col) << " "; } @@ -1184,8 +1185,7 @@ std::vector compute_1body_ints_deriv(unsigned deriv_order, ShellSetDerivIterator shellset_diter(deriv_order, nderivcenters_shset); while (shellset_diter) { - const auto& deriv = *shellset_diter; - (void)deriv; + LIBINT_MAYBE_UNUSED const auto& deriv = *shellset_diter; } } } // copy shell block switch @@ -2029,8 +2029,7 @@ Matrix compute_2body_fock_general(const BasisSet& obs, const Matrix& D, double precision) { const auto n = obs.nbf(); const auto nshells = obs.size(); - const auto n_D = D_bs.nbf(); - (void)n_D; + LIBINT_MAYBE_UNUSED const auto n_D = D_bs.nbf(); assert(D.cols() == D.rows() && D.cols() == n_D); using libint2::nthreads; @@ -2403,10 +2402,8 @@ void api_basic_compile_test(const BasisSet& obs, auto n1 = obs[s1].size(); // number of basis functions in first shell auto n2 = obs[s2].size(); // number of basis functions in second shell - const auto* buf4 = results4[0]; - (void)buf4; - const auto* buf2 = results2[0]; - (void)buf2; + LIBINT_MAYBE_UNUSED const auto* buf4 = results4[0]; + LIBINT_MAYBE_UNUSED const auto* buf2 = results2[0]; // this iterates over integrals in the order they are packed in array // ints_shellset @@ -2435,10 +2432,8 @@ void api_basic_compile_test(const BasisSet& obs, obs[s2].size(); // number of basis functions in second shell auto n3 = obs[s3].size(); // number of basis functions in third shell - const auto* buf4 = results4[0]; - (void)buf4; - const auto* buf3 = results3[0]; - (void)buf3; + LIBINT_MAYBE_UNUSED const auto* buf4 = results4[0]; + LIBINT_MAYBE_UNUSED const auto* buf3 = results3[0]; // this iterates over integrals in the order they are packed in array // ints_shellset @@ -2470,10 +2465,8 @@ void api_basic_compile_test(const BasisSet& obs, // loop over derivative shell sets for (auto d = 0; d != 6; ++d) { - const auto* buf4 = results4[d < 3 ? d : d + 3]; - (void)buf4; - const auto* buf2 = results2[d]; - (void)buf2; + LIBINT_MAYBE_UNUSED const auto* buf4 = results4[d < 3 ? d : d + 3]; + LIBINT_MAYBE_UNUSED const auto* buf2 = results2[d]; // this iterates over integrals in the order they are packed in array // ints_shellset @@ -2500,9 +2493,7 @@ void api_basic_compile_test(const BasisSet& obs, 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 @@ -2511,8 +2502,8 @@ void api_basic_compile_test(const BasisSet& obs, 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]; + LIBINT_MAYBE_UNUSED const auto* buf4 = results4[dd12]; + LIBINT_MAYBE_UNUSED const auto* buf2 = results2[d12]; // this iterates over integrals in the order they are packed in // array From 8490b80eaf4b217b6e2ded284b6de45794a31244 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Wed, 13 Dec 2023 12:30:25 -0500 Subject: [PATCH 3/8] introduce LIBINT_MAYBE_UNUSED and replaces uses of (void)variable to hush warnings about (potentially) unused variables --- include/libint2/config.h.in | 16 ++++++++++++++++ include/libint2/initialize.h | 5 ++--- src/bin/libint/tactic.cc | 6 ++---- tests/hartree-fock/hartree-fock++.cc | 4 ++-- tests/unit/test-precision.cc | 3 +-- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/include/libint2/config.h.in b/include/libint2/config.h.in index cc6895010..22b76c2ba 100644 --- a/include/libint2/config.h.in +++ b/include/libint2/config.h.in @@ -302,4 +302,20 @@ #define LIBINT_DEPRECATED(msg) LIBINT_XPRAGMA( LIBINT_CONCAT(message, msg) ) #endif +#ifdef __has_cpp_attribute +#if __has_cpp_attribute(maybe_unused) +#define LIBINT_MAYBE_UNUSED [[maybe_unused]] +#endif +#endif // __has_cpp_attribute +#ifndef LIBINT_MAYBE_UNUSED +#if defined __has_attribute +# if __has_attribute (unused) +# define LIBINT_MAYBE_UNUSED __attribute__ ((unused)) +# endif +#endif // __has_attribute +#endif // LIBINT_MAYBE_UNUSED +#ifndef LIBINT_MAYBE_UNUSED // fallback +#define LIBINT_MAYBE_UNUSED +#endif + #endif /* header guard */ diff --git a/include/libint2/initialize.h b/include/libint2/initialize.h index 27edb9c6c..fa71e3795 100644 --- a/include/libint2/initialize.h +++ b/include/libint2/initialize.h @@ -76,9 +76,8 @@ inline bool initialized() { inline void initialize(bool verbose = false) { if (!initialized()) { using namespace detail; - __initializer* x = managed_singleton<__initializer>::instance(); - (void)x; // to suppress unused variable warning (not guaranteed to work) - // TODO revise when upgrade to C++17 + LIBINT_MAYBE_UNUSED __initializer* x = + managed_singleton<__initializer>::instance(); assert(x != nullptr); verbose_accessor() = verbose; diff --git a/src/bin/libint/tactic.cc b/src/bin/libint/tactic.cc index 7ffb72927..aa4de30f1 100644 --- a/src/bin/libint/tactic.cc +++ b/src/bin/libint/tactic.cc @@ -182,8 +182,7 @@ TwoCenter_OS_Tactic::RR TwoCenter_OS_Tactic::optimal_rr( // children // (to reduce the memory bandwidth demand) size_t max_result_size = std::numeric_limits::max(); - size_t nties = 0; - (void)nties; + LIBINT_MAYBE_UNUSED size_t nties = 0; for (auto& t : stack) { if (t->braket_direction() == BraketDirection::None) { // skip all HRR RRs @@ -263,8 +262,7 @@ FourCenter_OS_Tactic::RR FourCenter_OS_Tactic::optimal_rr( // transfer direction matches the strategic direction since only non-ITR // 2-body OS strategies will include transfers in single direction size_t max_result_size = std::numeric_limits::max(); - size_t nties = 0; - (void)nties; + LIBINT_MAYBE_UNUSED size_t nties = 0; for (auto& t : stack) { if (t->partindex_direction() == 0) { // skip all ITR RRs diff --git a/tests/hartree-fock/hartree-fock++.cc b/tests/hartree-fock/hartree-fock++.cc index 4e65e5d5a..8dbfeb833 100644 --- a/tests/hartree-fock/hartree-fock++.cc +++ b/tests/hartree-fock/hartree-fock++.cc @@ -689,9 +689,9 @@ int main(int argc, char* argv[]) { } { // compute hessian - const auto ncoords = 3 * atoms.size(); + LIBINT_MAYBE_UNUSED const auto ncoords = 3 * atoms.size(); #if LIBINT2_DERIV_ONEBODY_ORDER > 1 - // compute 1-e hessian + // compute 1-e hessian Matrix H1 = Matrix::Zero(ncoords, ncoords); Matrix H_Pulay = Matrix::Zero(ncoords, ncoords); ////////// diff --git a/tests/unit/test-precision.cc b/tests/unit/test-precision.cc index 5b8f46d9b..6a3af961a 100644 --- a/tests/unit/test-precision.cc +++ b/tests/unit/test-precision.cc @@ -149,8 +149,7 @@ TEST_CASE("2-body integrals precision", "[2-body][precision]") { }); auto max_engine_screening_error = 0.; - bool engine_precision_too_low = false; - (void)engine_precision_too_low; + LIBINT_MAYBE_UNUSED bool engine_precision_too_low = false; const auto max_allowed_exceening_error_factor = 2; for (auto f = 0; f != nf; ++f) { auto& ref_v = ref_ints[0][f]; From 32b6e46dbccef7731956f1ef669a8615194eb2e0 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Fri, 15 Dec 2023 15:33:53 -0500 Subject: [PATCH 4/8] disables checking for latex2html since it's broken on a common platform (macos/brew) --- configure.ac | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c5e43b76d..0470290d2 100644 --- a/configure.ac +++ b/configure.ac @@ -1117,9 +1117,31 @@ AC_PATH_PROG(PDFLATEX,pdflatex,,$PATH:/usr/local/bin:/opt/local/bin) AC_PATH_PROG(PSLATEX,pslatex,,$PATH:/usr/local/bin:/opt/local/bin) AC_PATH_PROG(DVIPS,dvips,,$PATH:/usr/local/bin:/opt/local/bin) AC_PATH_PROG(LATEX,latex,,$PATH:/usr/local/bin:/opt/local/bin) -AC_PATH_PROG(LATEX2HTML,latex2html,,$PATH:/usr/local/bin:/opt/local/bin) AC_PATH_PROG(BIBTEX,bibtex,,$PATH:/usr/local/bin:/opt/local/bin) +CHECK_FOR_LATEX2HTML=no +AC_ARG_ENABLE(latex2html, +AS_HELP_STRING([--enable-latex2html],[Enable detection of latex2html (broken on many platforms, hence disabled by default)]), +[ +case $enableval in + yes) + CHECK_FOR_LATEX2HTML=yes + ;; + no) + CHECK_FOR_LATEX2HTML=no + ;; + *) + AC_MSG_ERROR([Invalid value for --enable-latex2html ($enableval)]) + ;; +esac +],[ + CHECK_FOR_LATEX2HTML=no +] +) +if [ X$CHECK_FOR_LATEX2HTML = Xyes ]; then + AC_PATH_PROG(LATEX2HTML,latex2html,,$PATH:/usr/local/bin:/opt/local/bin) +fi + dnl The lack of certain tools is a show stopper changequote(<<, >>)dnl From affb60f521a5c7dc7469d5c8fc4e58e4b4d40b0d Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Fri, 15 Dec 2023 15:33:53 -0500 Subject: [PATCH 5/8] disables checking for latex2html since it's broken on a common platform (macos/brew) --- configure.ac | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c5e43b76d..f37000d88 100644 --- a/configure.ac +++ b/configure.ac @@ -1117,9 +1117,31 @@ AC_PATH_PROG(PDFLATEX,pdflatex,,$PATH:/usr/local/bin:/opt/local/bin) AC_PATH_PROG(PSLATEX,pslatex,,$PATH:/usr/local/bin:/opt/local/bin) AC_PATH_PROG(DVIPS,dvips,,$PATH:/usr/local/bin:/opt/local/bin) AC_PATH_PROG(LATEX,latex,,$PATH:/usr/local/bin:/opt/local/bin) -AC_PATH_PROG(LATEX2HTML,latex2html,,$PATH:/usr/local/bin:/opt/local/bin) AC_PATH_PROG(BIBTEX,bibtex,,$PATH:/usr/local/bin:/opt/local/bin) +CHECK_FOR_LATEX2HTML=no +AC_ARG_ENABLE(latex2html, +AS_HELP_STRING([--enable-latex2html],[Enable detection of latex2html (broken on many platforms, hence disabled by default)]), +[ +case $enableval in + yes) + CHECK_FOR_LATEX2HTML=yes + ;; + no) + CHECK_FOR_LATEX2HTML=no + ;; + *) + AC_MSG_ERROR([Invalid value for --enable-latex2html ($enableval)]) + ;; +esac +],[ + CHECK_FOR_LATEX2HTML=no +] +) +if test "X$CHECK_FOR_LATEX2HTML" = "Xyes" ; then + AC_PATH_PROG(LATEX2HTML,latex2html,,$PATH:/usr/local/bin:/opt/local/bin) +fi + dnl The lack of certain tools is a show stopper changequote(<<, >>)dnl From 35f6622a23d02fac581bbcd7c5728795a773b0d5 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Mon, 18 Dec 2023 17:29:51 -0500 Subject: [PATCH 6/8] do not break dvi build if pslatex or pdflatex is found fixup for https://github.com/evaleev/libint/commit/db8ef0fbfc0a8be9956d538acf0c9e167be7dfad --- doc/MakeVars.in | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/MakeVars.in b/doc/MakeVars.in index 5052ef7a7..2a6479630 100644 --- a/doc/MakeVars.in +++ b/doc/MakeVars.in @@ -33,13 +33,12 @@ BIBTEX = @BIBTEX@ # The document suffix (pdf or ps) # Preferentially make pdf manuals, only revert to ps if necessary ifdef BIBTEX + DOCSUF = dvi ifdef PSLATEX DOCSUF = ps - LATEX = $(PSLATEX) endif ifdef PDFLATEX DOCSUF = pdf - LATEX = $(PDFLATEX) endif endif TEXINPUTS = :$(SRCDIR):$(SRCDIR)/..: @@ -54,4 +53,3 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ docdir=$(prefix)/doc includedir=@libintincludedir@ - From dfc15498bb333e48e38961fc9f766303d8fbaf2a Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Mon, 18 Dec 2023 17:30:42 -0500 Subject: [PATCH 7/8] fixup latex2html invocation --- doc/MakeRules.in | 4 +++- doc/progman/Makefile | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/MakeRules.in b/doc/MakeRules.in index 8df23668c..7e0f8fd8e 100644 --- a/doc/MakeRules.in +++ b/doc/MakeRules.in @@ -5,7 +5,7 @@ default:: $(TARGET) install:: install_target -install_target:: default +install_target:: $(TARGET) $(INSTALL) $(INSTALLDIROPT) $(DESTDIR)$(docdir) $(LTINST) $(INSTALL) $(INSTALLDOCOPT) $(TARGET) $(DESTDIR)$(docdir) @@ -18,3 +18,5 @@ targetclean:: clean realclean:: clean -rm -f $(TEXGARBAGE) + +.PHONY: dvi html pdf ps install_target default install clean distclean targetclean realclean diff --git a/doc/progman/Makefile b/doc/progman/Makefile index b4250cbfc..447a06b03 100644 --- a/doc/progman/Makefile +++ b/doc/progman/Makefile @@ -77,8 +77,8 @@ install-dvi:: dvi TEXINPUTS=$(TEXINPUTS) $(LATEX) $< ifdef LATEX2HTML -html:: dvi - $(LATEX2HTML) $(TARGETNAME) +html:: $(SRCDIR)/$(TARGETNAME).tex + $(LATEX2HTML) $< endif endif From 438f4a9e7d71cdad7626d196ec481a1257d6742f Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Tue, 19 Dec 2023 06:24:15 -0500 Subject: [PATCH 8/8] ready for 2.8.1 --- .github/workflows/cmake.yml | 4 ++-- CHANGES | 5 +++++ configure.ac | 2 +- export/cmake/CMakeLists.txt.export | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 24b5c0841..ce187abc9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -141,7 +141,7 @@ jobs: cat > CMakeLists.txt < CMakeLists.txt <=7 AOs correctly diff --git a/configure.ac b/configure.ac index f37000d88..d32f563ed 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -define([libint_mmm_version],[2.8.0]) +define([libint_mmm_version],[2.8.1]) define([libint_buildid],[]) define([libint_so_version],[2:3:0]) diff --git a/export/cmake/CMakeLists.txt.export b/export/cmake/CMakeLists.txt.export index 4b4c389a4..0bfa4e67c 100644 --- a/export/cmake/CMakeLists.txt.export +++ b/export/cmake/CMakeLists.txt.export @@ -8,7 +8,7 @@ project(Libint LANGUAGES CXX C) # Set Libint version =================================================================================================== set(LIBINT_MAJOR_VERSION 2) set(LIBINT_MINOR_VERSION 8) -set(LIBINT_MICRO_VERSION 0) +set(LIBINT_MICRO_VERSION 1) set(LIBINT_BUILDID ) set(LIBINT_VERSION "${LIBINT_MAJOR_VERSION}.${LIBINT_MINOR_VERSION}.${LIBINT_MICRO_VERSION}") if (LIBINT_BUILDID)