Skip to content

Commit 50a76fc

Browse files
committed
fns compile
1 parent 27e386e commit 50a76fc

File tree

5 files changed

+34
-19
lines changed

5 files changed

+34
-19
lines changed

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ project(
2323
Libint2Compiler
2424
VERSION ${LibintRepository_VERSION}
2525
DESCRIPTION
26-
"Libint: A library for the evaluation of molecular integrals of many-body operators over Gaussian functions"
26+
"A library for the evaluation of molecular integrals of many-body operators over Gaussian functions"
2727
HOMEPAGE_URL "http://libint.valeyev.net"
2828
LANGUAGES CXX
2929
)
@@ -36,6 +36,7 @@ set(${PROJECT_NAME}_LICENSE "GPL-3.0 for generator; LGPL-3.0 for generated")
3636
# describe`, these are the authoritative version source (formerly in configure.ac)
3737
set(LIBINT_BUILDID "post999")
3838
set(LIBINT_SOVERSION "2:3:0")
39+
set(LIBINT_DOI "10.5281/zenodo.10369117") # 2.8.0
3940

4041
include(int_versions)
4142

cmake/modules/int_versions.cmake

+6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# top-level CMakeLists.txt has defined:
22
# * PROJECT_VERSION_{MAJOR|MINOR|PATCH} through `project(... VERSION)`
3+
# * Libint2Compiler_DESCRIPTION through `project(... DESCRIPTION)`
34
# * LIBINT_BUILDID
45
# * LIBINT_SOVERSION
6+
# * LIBINT_DOI
57
# * LibintRepository_{VERSION|DESCRIBE|COMMIT|DISTANCE} through `dynamic_version()`
68

79
# note that 3rd version integer is PATCH in CMake and MICRO in Libint
@@ -25,9 +27,13 @@ endif()
2527
string(SUBSTRING ${LibintRepository_COMMIT} 0 7 LIBINT_GIT_COMMIT)
2628
message(DEBUG "LIBINT_GIT_COMMIT ${LIBINT_GIT_COMMIT}")
2729

30+
# Below goes into BibTeX citation. Currently year of export. For year of tag, parse:
31+
# `git show -s --no-notes --date=short --pretty='%cd' v2.7.2` responds: 2022-06-20
2832
string(TIMESTAMP LIBINT_VERSION_YEAR "%Y")
2933
message(DEBUG "LIBINT_VERSION_YEAR ${LIBINT_VERSION_YEAR}")
3034

35+
set(LIBINT_DESCRIPTION "${Libint2Compiler_DESCRIPTION}")
36+
message(DEBUG "LIBINT_DESCRIPTION ${LIBINT_DESCRIPTION}")
3137

3238
# <<< Build Version >>>
3339

include/libint2/util/configuration.h

+7-5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#ifndef _libint2_include_libint2_util_configuration_h_
2222
#define _libint2_include_libint2_util_configuration_h_
2323

24+
#include <stdbool.h>
25+
2426
/* Runtime accessor for the library configuration:
2527
integral derivatives, AM, orderings, etc.
2628
@return the semicolon-separated strings from CMake components */
@@ -31,9 +33,9 @@ void libint_version(int *, int *, int *);
3133

3234
/* Get the version of Libint as a string
3335
@return the version string. At release, strictly "M.m.p" (no alpha/rc/etc.).
34-
Beyond release (ext=True), returns "M.m.p.postD" where D is distance from
35-
release. Beyond release (ext=False), returns most recent release, "M.m.p". */
36-
const char *libint_version_string(bool ext = true);
36+
Beyond release (arg=true), returns "M.m.p.postD" where D is distance from
37+
release. Beyond release (arg=false), returns most recent release, "M.m.p". */
38+
const char *libint_version_string(bool);
3739

3840
/* Get the git commit at which library was generated
3941
@return the commit as a 7-char abbreviated string */
@@ -96,8 +98,8 @@ inline std::tuple<int, int, int> libint_version() {
9698
/// @param[in] whether to return the simple-sortable last release or a
9799
/// per-commit version
98100
/// @return the version string. At release, strictly "M.m.p" (no alpha/rc/etc.).
99-
/// Beyond release (ext=True), returns "M.m.p.postD" where D is distance from
100-
/// release. Beyond release (ext=False), returns most recent release, "M.m.p".
101+
/// Beyond release (ext=true), returns "M.m.p.postD" where D is distance from
102+
/// release. Beyond release (ext=false), returns most recent release, "M.m.p".
101103
inline std::string libint_version_string(bool ext = true) {
102104
std::string version = ::libint_version_string(ext);
103105
return version;

src/lib/libint/configuration.cc

+14-13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
*
1919
*/
2020

21+
#include <cstdio>
22+
#include <cstring>
23+
#include <libint2/util/configuration.h>
24+
2125
const char *configuration_accessor(void) {
2226
// return "@Libint2_CONFIG_COMPONENTS@";
2327
return "(nyi)";
@@ -27,7 +31,7 @@ void libint_version(int *major, int *minor, int *micro) {
2731
*major = -1;
2832
*minor = -1;
2933
*micro = -1;
30-
sscanf(libint_version_string(ext = false), "%d.%d.%d", major, minor, micro);
34+
std::sscanf(libint_version_string(false), "%d.%d.%d", major, minor, micro);
3135
}
3236

3337
const char *libint_version_string(bool ext) {
@@ -40,23 +44,20 @@ const char *libint_version_string(bool ext) {
4044
const char *libint_commit(void) { return "@LIBINT_GIT_COMMIT@"; }
4145

4246
const char *libint_reference(void) {
43-
std::string ref;
44-
ref =
45-
"Libint: A library for the evaluation of molecular integrals of "
46-
"many-body operators over Gaussian functions, Version " +
47-
std::string(libint_version_string()) +
48-
" Edward F. Valeev, http://libint.valeyev.net/";
49-
return ref.c_str();
50-
}
47+
std::string ref = "Libint: @LIBINT_DESCRIPTION@, Version " + std::string(libint_version_string(true)) + " Edward F. Valeev, http://libint.valeyev.net/";
5148

52-
const char *libint_reference_doi(void) {
53-
return "10.5281/zenodo.10369117"; // 2.8.0
49+
auto slen = ref.length();
50+
char * cref = new char[slen + 1];
51+
std::memcpy(cref, ref.c_str(), slen);
52+
cref[slen] = '\0';
53+
return cref;
5454
}
5555

56+
const char *libint_reference_doi(void) { return "@LIBINT_DOI@"; }
57+
5658
const char *libint_bibtex(void) {
5759
return "@Misc{Libint2,\n author = {E.~F.~Valeev},\n title = "
58-
"{\\textsc{Libint}: A library for the evaluation of molecular "
59-
"integrals of many-body operators over Gaussian functions},\n "
60+
"{\\textsc{Libint}: @LIBINT_DESCRIPTION@},\n "
6061
"howpublished = {http://libint.valeyev.net/},\n note = {version "
6162
"@Libint2_VERSION@},\n year = {@LIBINT_VERSION_YEAR@}\n}\n";
6263
}

tests/unit/test.cc

+5
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ int main(int argc, char* argv[]) {
6666
libint2::configuration_accessor().c_str());
6767
printf("Supports: dddd=%d mmmm=%d FF=%d\n", libint2::supports("eri_dddd_d0"),
6868
libint2::supports("eri_mmmm_d0"), libint2::supports("eri_FF_d0"));
69+
auto Mmp = libint2::libint_version();
70+
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());
71+
printf("Version: Major=%d minor=%d patch=%d\n", std::get<0>(Mmp), std::get<1>(Mmp), std::get<2>(Mmp));
72+
printf("Citation: DOI=%s Ref=%s\n", libint2::libint_reference_doi().c_str(), libint2::libint_reference().c_str());
73+
printf("Citation: BibTex=%s\n", libint2::libint_bibtex().c_str());
6974

7075
#ifdef LIBINT_HAS_MPFR
7176
// default to 256 bits of precision for mpf_class

0 commit comments

Comments
 (0)