diff --git a/CMakeLists.txt b/CMakeLists.txt index b5620d7ef..cffb5362b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ project( Libint2Compiler VERSION ${LibintRepository_VERSION} DESCRIPTION - "Libint: A library for the evaluation of molecular integrals of many-body operators over Gaussian functions" + "A library for the evaluation of molecular integrals of many-body operators over Gaussian functions" HOMEPAGE_URL "http://libint.valeyev.net" LANGUAGES CXX ) @@ -36,6 +36,7 @@ set(${PROJECT_NAME}_LICENSE "GPL-3.0 for generator; LGPL-3.0 for generated") # describe`, these are the authoritative version source (formerly in configure.ac) set(LIBINT_BUILDID "post999") set(LIBINT_SOVERSION "2:3:0") +set(LIBINT_DOI "10.5281/zenodo.10369117") # 2.8.0 include(int_versions) diff --git a/INSTALL.md b/INSTALL.md index 33c868df6..b6acf48a7 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -130,3 +130,27 @@ Eventually, these will be CMake Components, too. bs - library integrals use ordering bagel + standard = bagel bo - library integrals use ordering + orca ``` + +### Interfacing + +Eventually (approximately 2.9.0 CMake-based), additional functions will be available to retrive Libint version, commit, and literature citation. Below are outputs at the libtool stage. + +``` +auto Mmp = libint2::libint_version(); +printf("Version: Numeric=%s Sortable=%s Commit=%s\n", libint2::libint_version_string(false).c_str(), libint2::libint_version_string(true).c_str(), libint2::libint_commit().c_str()); +printf("Version: Major=%d minor=%d patch=%d\n", std::get<0>(Mmp), std::get<1>(Mmp), std::get<2>(Mmp)); +printf("Citation: DOI=%s Ref=%s\n", libint2::libint_reference_doi().c_str(), libint2::libint_reference().c_str()); +printf("Citation: BibTex=%s\n", libint2::libint_bibtex().c_str()); +``` +``` +Version: Numeric=2.8.0 Sortable= Commit= +Version: Major=2 minor=8 patch=0 +Citation: DOI= Ref=Libint: , Version Edward F. Valeev, http://libint.valeyev.net/ +Citation: BibTex=@Misc{Libint2, + author = {E.~F.~Valeev}, + title = {\textsc{Libint}: }, + howpublished = {http://libint.valeyev.net/}, + note = {version }, + year = {} +} +``` diff --git a/cmake/modules/int_versions.cmake b/cmake/modules/int_versions.cmake index c2064a800..973e51b46 100644 --- a/cmake/modules/int_versions.cmake +++ b/cmake/modules/int_versions.cmake @@ -1,7 +1,9 @@ # top-level CMakeLists.txt has defined: # * PROJECT_VERSION_{MAJOR|MINOR|PATCH} through `project(... VERSION)` +# * Libint2Compiler_DESCRIPTION through `project(... DESCRIPTION)` # * LIBINT_BUILDID # * LIBINT_SOVERSION +# * LIBINT_DOI # * LibintRepository_{VERSION|DESCRIBE|COMMIT|DISTANCE} through `dynamic_version()` # note that 3rd version integer is PATCH in CMake and MICRO in Libint @@ -25,9 +27,13 @@ endif() string(SUBSTRING ${LibintRepository_COMMIT} 0 7 LIBINT_GIT_COMMIT) message(DEBUG "LIBINT_GIT_COMMIT ${LIBINT_GIT_COMMIT}") +# Below goes into BibTeX citation. Currently year of export. For year of tag, parse: +# `git show -s --no-notes --date=short --pretty='%cd' v2.7.2` responds: 2022-06-20 string(TIMESTAMP LIBINT_VERSION_YEAR "%Y") message(DEBUG "LIBINT_VERSION_YEAR ${LIBINT_VERSION_YEAR}") +set(LIBINT_DESCRIPTION "${Libint2Compiler_DESCRIPTION}") +message(DEBUG "LIBINT_DESCRIPTION ${LIBINT_DESCRIPTION}") # <<< Build Version >>> diff --git a/include/libint2/util/configuration.h b/include/libint2/util/configuration.h index 1aa7de1df..63fbb3c3a 100644 --- a/include/libint2/util/configuration.h +++ b/include/libint2/util/configuration.h @@ -21,6 +21,8 @@ #ifndef _libint2_include_libint2_util_configuration_h_ #define _libint2_include_libint2_util_configuration_h_ +#include + /* Runtime accessor for the library configuration: integral derivatives, AM, orderings, etc. @return the semicolon-separated strings from CMake components */ @@ -31,9 +33,9 @@ void libint_version(int *, int *, int *); /* Get the version of Libint as a string @return the version string. At release, strictly "M.m.p" (no alpha/rc/etc.). - Beyond release (ext=True), returns "M.m.p.postD" where D is distance from - release. Beyond release (ext=False), returns most recent release, "M.m.p". */ -const char *libint_version_string(bool ext = true); + Beyond release (arg=true), returns "M.m.p.postD" where D is distance from + release. Beyond release (arg=false), returns most recent release, "M.m.p". */ +const char *libint_version_string(bool); /* Get the git commit at which library was generated @return the commit as a 7-char abbreviated string */ @@ -96,8 +98,8 @@ inline std::tuple libint_version() { /// @param[in] whether to return the simple-sortable last release or a /// per-commit version /// @return the version string. At release, strictly "M.m.p" (no alpha/rc/etc.). -/// Beyond release (ext=True), returns "M.m.p.postD" where D is distance from -/// release. Beyond release (ext=False), returns most recent release, "M.m.p". +/// Beyond release (ext=true), returns "M.m.p.postD" where D is distance from +/// release. Beyond release (ext=false), returns most recent release, "M.m.p". inline std::string libint_version_string(bool ext = true) { std::string version = ::libint_version_string(ext); return version; diff --git a/src/lib/libint/configuration.cc b/src/lib/libint/configuration.cc index 7529b0cbc..aa4edc5e6 100644 --- a/src/lib/libint/configuration.cc +++ b/src/lib/libint/configuration.cc @@ -18,6 +18,11 @@ * */ +#include + +#include +#include + const char *configuration_accessor(void) { // return "@Libint2_CONFIG_COMPONENTS@"; return "(nyi)"; @@ -27,7 +32,7 @@ void libint_version(int *major, int *minor, int *micro) { *major = -1; *minor = -1; *micro = -1; - sscanf(libint_version_string(ext = false), "%d.%d.%d", major, minor, micro); + std::sscanf(libint_version_string(false), "%d.%d.%d", major, minor, micro); } const char *libint_version_string(bool ext) { @@ -40,23 +45,22 @@ const char *libint_version_string(bool ext) { const char *libint_commit(void) { return "@LIBINT_GIT_COMMIT@"; } const char *libint_reference(void) { - std::string ref; - ref = - "Libint: A library for the evaluation of molecular integrals of " - "many-body operators over Gaussian functions, Version " + - std::string(libint_version_string()) + - " Edward F. Valeev, http://libint.valeyev.net/"; - return ref.c_str(); -} + std::string ref = "Libint: @LIBINT_DESCRIPTION@, Version " + + std::string(libint_version_string(true)) + + " Edward F. Valeev, http://libint.valeyev.net/"; -const char *libint_reference_doi(void) { - return "10.5281/zenodo.10369117"; // 2.8.0 + auto slen = ref.length(); + char *cref = new char[slen + 1]; + std::memcpy(cref, ref.c_str(), slen); + cref[slen] = '\0'; + return cref; } +const char *libint_reference_doi(void) { return "@LIBINT_DOI@"; } + const char *libint_bibtex(void) { return "@Misc{Libint2,\n author = {E.~F.~Valeev},\n title = " - "{\\textsc{Libint}: A library for the evaluation of molecular " - "integrals of many-body operators over Gaussian functions},\n " + "{\\textsc{Libint}: @LIBINT_DESCRIPTION@},\n " "howpublished = {http://libint.valeyev.net/},\n note = {version " "@Libint2_VERSION@},\n year = {@LIBINT_VERSION_YEAR@}\n}\n"; } diff --git a/tests/unit/test.cc b/tests/unit/test.cc index cf8a09aa3..98beb47b4 100644 --- a/tests/unit/test.cc +++ b/tests/unit/test.cc @@ -66,6 +66,11 @@ int main(int argc, char* argv[]) { libint2::configuration_accessor().c_str()); printf("Supports: dddd=%d mmmm=%d FF=%d\n", libint2::supports("eri_dddd_d0"), libint2::supports("eri_mmmm_d0"), libint2::supports("eri_FF_d0")); + auto Mmp = libint2::libint_version(); + printf("Version: Numeric=%s Sortable=%s Commit=%s\n", libint2::libint_version_string(false).c_str(), libint2::libint_version_string(true).c_str(), libint2::libint_commit().c_str()); + printf("Version: Major=%d minor=%d patch=%d\n", std::get<0>(Mmp), std::get<1>(Mmp), std::get<2>(Mmp)); + printf("Citation: DOI=%s Ref=%s\n", libint2::libint_reference_doi().c_str(), libint2::libint_reference().c_str()); + printf("Citation: BibTex=%s\n", libint2::libint_bibtex().c_str()); #ifdef LIBINT_HAS_MPFR // default to 256 bits of precision for mpf_class