Skip to content

Commit

Permalink
fns compile
Browse files Browse the repository at this point in the history
  • Loading branch information
loriab committed Dec 14, 2023
1 parent 27e386e commit 50a76fc
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 19 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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)

Expand Down
6 changes: 6 additions & 0 deletions cmake/modules/int_versions.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 >>>

Expand Down
12 changes: 7 additions & 5 deletions include/libint2/util/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#ifndef _libint2_include_libint2_util_configuration_h_
#define _libint2_include_libint2_util_configuration_h_

#include <stdbool.h>

/* Runtime accessor for the library configuration:
integral derivatives, AM, orderings, etc.
@return the semicolon-separated strings from CMake components */
Expand All @@ -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 */
Expand Down Expand Up @@ -96,8 +98,8 @@ inline std::tuple<int, int, int> 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;
Expand Down
27 changes: 14 additions & 13 deletions src/lib/libint/configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
*
*/

#include <cstdio>
#include <cstring>
#include <libint2/util/configuration.h>

const char *configuration_accessor(void) {
// return "@Libint2_CONFIG_COMPONENTS@";
return "(nyi)";
Expand All @@ -27,7 +31,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) {
Expand All @@ -40,23 +44,20 @@ 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";
}
5 changes: 5 additions & 0 deletions tests/unit/test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 50a76fc

Please sign in to comment.