Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test solid harmonic ordering runtime switchable #271

Merged
merged 12 commits into from
Nov 24, 2023

Conversation

loriab
Copy link
Collaborator

@loriab loriab commented Sep 4, 2023

currently atop #270

  • tl;dr Ignoring all the testing, libtool, pkgconfig, and docs stuff, this PR has only one important line: https://github.com/evaleev/libint/pull/271/files#diff-6b025276ef426b69c020c54935b3573f2983a24424bad15bcb5693d6ceeb719eR196
  • add testing for printing configuration_accessor() (I missed compiling it in in gss/sss (solid harmonic ordering) runtime switchable #269). Add testing for switching the SHO in the built library. The main test is duplicated as test_g.cc so standard and gaussian orderings get accessed regularly. Alternate reference values added.
  • Compared to c. Sept 2023 versions of this PR (and compared to cmake harness, 2023 edition #259) that used 3-letter codes for solid+cart+shell ordering (e.g. gss, sss (default), soo), this now uses 2-letter codes cart+shell (e.g., ss, oo) for configuration tagging. This is possible because:
    • gss/sss (solid harmonic ordering) runtime switchable #269 made the first letter (s or g) configurable at runtime, so there's no need to label a built library for the ERI role. (was library-configuration-time, now library-runtime)
    • cdbb9f3 made spherical multipole ints non-configurable, so there's no need to record their ordering in the built library. (was generator-configuration-time, now inconfigurable)
  • Compared to c.Sept 2023 versions of this PR (and compared to cmake harness, 2023 edition #259), new forms are used for cmake components.
    • eri_c4_dD_lL --> eri_hhhh_dD
    • eri_c3_dD_lL and impure_sh --> eri_hhL_dD and eri_hhl_dD
    • eri_c2_dD_lL and impure_sh --> eri_HH_dD and eri_hh_dD
    • onebody_dD_lL --> onebody_h_dD --> onebody_hh_dD
    • g12_dD_lL --> g12_h_dD --> g12_hhhh_dD
    • nothing --> multipole_h? --> multipole_hh_dD
  • fix up libint.pc for the pkgconfig folks according to request in new cmake harness #205 (review) . The existing pc file didn't look populated in the export, so I added a separate one. Fixed hard-coding of pc file installation, but one does still need to set both LIBINT2_INSTALL_LIBDIR and CMAKE_INSTALL_LIBDIR to co-locate the library, the cmake config files, and the pkgconfig files.
  • enable default unity build for library (needs cmake 3.16). add a couple status variables to the libint2-config.cmake file. copy over a bit of the INSTALL.md from cmake harness, 2023 edition #259
  • cherry-pick over some EFV commits that looked important from new cmake harness #205

closes #225
closes #230

Downstream testing (still using sss, not ss)

Downstream testing (now ss-based; mostly dev1 -> dev2; Oct 30)

@loriab loriab force-pushed the targetsconfig branch 2 times, most recently from 3183a6a to 269bc67 Compare October 12, 2023 22:08
@loriab
Copy link
Collaborator Author

loriab commented Oct 12, 2023

This is rebased and updated and ready for consideration, I think. I'm glad to make any changes.

@loriab loriab requested a review from evaleev October 12, 2023 23:31
INSTALL.md Outdated
```
onebody_dD_lL - library includes 1-body integrals with derivative order D (D=0,1,2,...) and max angular momentum up to L (L=2,3,4,...)
eri_cC_dD_lL - library includes 2-body integrals with C (C=2,3,4) centers, derivative order D (D=0,1,2,...), and max angular momentum up to L (L=2,3,4,...)
g12_dD-lL - library includes F12 integrals with Gaussian factors with derivative order D and max angular momentum up to L
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I'll change line 78 to g12_dD_lL - library includes F12 integrals with Gaussian factors with derivative order D (D=0,1,2,...) and max angular momentum up to L (L=2,3,4,...). Did I miss anything on lines 76 or 77?

INSTALL.md Outdated
const char * configuration_accessor() {
//return "@Libint2_CONFIG_COMPONENTS@";
- return "(nyi)";
+ return "eri_c2_d0_l2;eri_c2_d0_l3;eri_c2_d0_l4;eri_c2_d0_l5;eri_c2_d0_l6;eri_c2_d1_l2;eri_c2_d1_l3;eri_c2_d1_l4;eri_c2_d1_l5;eri_c3_d0_l2;eri_c3_d0_l3;eri_c3_d0_l4;eri_c3_d0_l5;eri_c3_d0_l6;eri_c3_d1_l2;eri_c3_d1_l3;eri_c3_d1_l4;eri_c3_d1_l5;eri_c4_d0_l2;eri_c4_d0_l3;eri_c4_d0_l4;eri_c4_d0_l5;eri_c4_d1_l2;eri_c4_d1_l3;eri_c4_d1_l4;g12_d0_l2;g12_d0_l3;g12_d0_l4;g12_d1_l2;g12_d1_l3;g12_d1_l4;impure_sh;onebody_d0_l2;onebody_d0_l3;onebody_d0_l4;onebody_d0_l5;onebody_d0_l6;onebody_d1_l2;onebody_d1_l3;onebody_d1_l4;onebody_d1_l5;onebody_d2_l2;onebody_d2_l3;onebody_d2_l4;ss";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am slightly concerned about the lack of support for different angular momenta on different centers in component notation ... how about instead of eri_c3_d1_l5 and eri_c2_d1_l5 we say eri_hhH_d1 and eri_HH_d1, with h and H denotting Cartesian and solid harmonic l=5 Gaussians? And instead of impure_sh we would make eri_hhh_d1 and ``eri_hh_d1` available.

It is likely Psi does not use this currently, but generally this is useful since fitting basis should include higher l than the corresponding orbital basis, so it makes sense to have "fitting" centers to support higher l than the rest...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the mixed AM on different centers specifiable through the build system now? (I suppose I've never specified AM for eri2 and eri3 differently.) I'm not quite following how h and H relate to generator input parameters. If h=4 and H=5, would the component be eri_hhH445_d1? Otherwise wouldn't h=4 and H=4 with pure-sh=T/F look the same?

Having two input variables (eri2 max AM and eri3 max AM) can generate a lot more components when filling in all the lesser accessible components (e.g., 445 means 444, 335, 225, etc. all accessible and might be requested by a L2 consumer), but in a pinch I can outsource it to python and not rely on CMake math.

Would 4-center remain unchanged, eri_c4_d1_l5 or eri_d1_l5, or should it switch to the new form, like eri_hhhh4444_d1?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is doable, but none of the public releases use this. Note use of lmax in https://github.com/evaleev/libint/blob/master/src/bin/libint/build_libint.cc#L1145 vs. lmax_default in https://github.com/evaleev/libint/blob/master/src/bin/libint/build_libint.cc#L1146 ... so configuring with --with-max-am=6 --with-eri3-max-am=7 would allow computing (k|ii) integrals ...

we indeed would need to provide means of "comparison" for component strings, e.g. libint2::supports("eri_ffG") ... doing this in 2 places would be a total waste of effort, might be worth building a c++ helper code and calling it from cmake to avoid logic duplication

I would prefer making format uniform for all cases, e.g. eri_hhhh_d1.

What do you think?

Copy link
Collaborator Author

@loriab loriab Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is doable, but none of the public releases use this. Note use of lmax in https://github.com/evaleev/libint/blob/master/src/bin/libint/build_libint.cc#L1145 vs. lmax_default in https://github.com/evaleev/libint/blob/master/src/bin/libint/build_libint.cc#L1146 ... so configuring with --with-max-am=6 --with-eri3-max-am=7 would allow computing (k|ii) integrals ...

Aha, good to know. Down the road in #259, this is going to require some changes, as I presently assume the generic max-am is simply the largest of eri-max-am, eri3-max-am, eri2-max-am, not an independent information source.

we indeed would need to provide means of "comparison" for component strings, e.g. libint2::supports("eri_ffG") ... doing this in 2 places would be a total waste of effort, might be worth building a c++ helper code and calling it from cmake to avoid logic duplication

Ok, I see what you mean now about hhH turning into ffG w/distinguishable lowercase/caps rather than 334. I'll test, but I'm pretty sure CMake component handling is case sensitive, so that'll be fine. Letters are nice for humans but a bit harder for computers to compare (though it just needs a translation string and a L=7 convention). EDIT: Now that I think on it, if components run AM together <h><h><H> rather than label them l<L>, the vars must be letters, not ints.

The c++ comparison helper code called from cmake I don't think is a great strategy, if I'm understanding it correctly. The key step is libint2-config.cmake accessed at find_package(Libint2) time. That's a fairly dumb code that works on strings and the presence/absence of files. I've never seen external functions called from it. And if there's cross-compiling happening, the helper code might not even run at detection time on detection hardware. So I think the long enumeration of accessible strings is sadly the best cmake-wise. I'd probably switch from the string being cmake-computed to it being Python-computed, adding a req'd Py to the first line build_libint https://github.com/loriab/libint/blob/new-cmake-2023-take2-b/INSTALL.md#prerequisites .

For background, my existing plan for configuration access was the following:

To address your libint2::supports proposal, I could have the configuration_accessor take an optional string argument, say eri_ffG. Then the fn splits at ; and returns found or not. It's a lot dumber than the comparison fn you suggested, since the combinatorics are pre-generated, but the effect to the user is the same.

I would prefer making format uniform for all cases, e.g. eri_hhhh_d1. What do you think?

Sure, I like uniform, too. I'll sketch out some input parameters to cmake component scenarios this afternoon to make sure I understand the conversion. How do you feel about retaining the explicitly enumerated component string for reasons described above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eri_ffg_d0 (all lowercase; mixed AM) is a thing, right? That is, differing AM on the unpaired index is possible w/o --enable-eri3-pure-sh=yes. So the format string is eri_hhL_dD (always when eri3 enabled) and eri_hhl_dD (unless --enable-eri3-pure-sh)?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eri_ffg_d0 (all lowercase; mixed AM) is a thing, right? That is, differing AM on the unpaired index is possible w/o --enable-eri3-pure-sh=yes. So the format string is eri_hhL_dD (always when eri3 enabled) and eri_hhl_dD (unless --enable-eri3-pure-sh)?

exactly. hence the use of letters instead of digits

Copy link
Collaborator Author

@loriab loriab Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I missed your comments from an hour ago. I'll read them next. I just pushed docs revised according to the component plan from this morning and a component list from the sample configuration.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To address your libint2::supports proposal, I could have the configuration_accessor take an optional string argument, say eri_ffG. Then the fn splits at ; and returns found or not. It's a lot dumber than the comparison fn you suggested, since the combinatorics are pre-generated, but the effect to the user is the same.

that would work, or if we are going full python for this code we can do the parse easily. The problem with enumerating all possibilities is that L^4 entries for large L can be quite large ... for heavy elements we will need full support for L=6 at least and with DF I can envision needing iiL ints (i.e. OBS max L = 6, DFBS max L = 8).

For configuration identification purposes, I was only thinking of e.g., eri_iiii_d0, eri_hhhh_d0, etc. since the different centers of a 4-center can't be specified independently in the buildsys (right?), so there's not the L^4 threat to the component list. So one wouldn't be calling find_package(Libint2 COMPONENTS eri_ghgh_d0) or libint2::supports(eri_ghgh_d0). Do you foresee people needing to call libint2::supports/configuration_acessor() with that mixed/L^4 case? I guess I figured consumers would be calling configuration_accessor once and collecting some AM/deriv limits for large-scale logic, not calling on all AM combinations.

I suppose the only immediate decision for this PR is whether you want the bool libint2::supports(std::string component) { /* pseudocode */ return component in configuration_accessor().split(";") }.


I tentatively revised the onebody_ component format for uniformity to onebody_h_dD. Not sure what to do on the g12 unless g12_hhhh_dD. I also never happened to put in components for multipole order; could be multipole_h_dD if you like.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and added libint2::supports. Known remaining issues include settling on onebody/g12/multipole? formats and updating the sample patch. I've got a couple CHANGES changes, too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now with revised component code strings for onebody, g12, and multipole.

@loriab loriab force-pushed the targetsconfig branch 2 times, most recently from 19503b8 to aacd585 Compare October 19, 2023 05:27
@timostrunk timostrunk mentioned this pull request Oct 26, 2023
5 tasks
@loriab loriab force-pushed the targetsconfig branch 2 times, most recently from 2c75f60 to 4f37c4f Compare October 29, 2023 15:52
@loriab
Copy link
Collaborator Author

loriab commented Oct 30, 2023

I've updated the testing of downstream packaging and psi4 usage with the revised component names. Links are in the last section of the PR frontmatter. I might add a script for the generation of cmake components for the patch (I've been doing it by hand), but that can be a separate PR if this is otherwise in good shape.

@evaleev
Copy link
Owner

evaleev commented Oct 30, 2023

@loriab thank you, this looks great!!! The only thing I would consider changing make the encoding of angular momenta and derivatives into non-eri components more systematic and future-proof by replacing multipole_l -> multipole_ll_dD ... i.e. all compute types can have derivatives, and for all operator set types we can have arbitrary number of centers, e.g. 4-center (1-e) overlaps are useful, although those one can get via the eri route by tweaking the core integrals. Still, would be useful to keep things systematic. What do you think?

@loriab
Copy link
Collaborator Author

loriab commented Oct 31, 2023

Great! I'm all for systematizing and future-proofing the components, but I may not be following the extent of what you're proposing. Were you thinking of <operator>_[<hh>|<HH>|<hhl>|<hhL>|<hhhh>]_d<D> for each operator in https://github.com/evaleev/libint/wiki/using-modern-CPlusPlus-API#create-an-integral-engine ? E.g., eri_* get renamed to coulomb_ and g12_ to cgtg_ (plus getting 2,3,4-center components)?

On one hand, this (a) would make the connection between build configuration arguments and integrals classes provided much clearer, (b) I don't see any limitation on the length of CMake lists, (c) in future, they're all substituted into the l2-config.cmake, so there's no added complexity https://github.com/loriab/libint/blob/new-cmake-2023-take2-b/cmake/libint2-config.cmake.in#L166-L168, and (d) it's especially useful in the libint2::supports function.

On the other hand, for a max-am-eri=5,4,3 (a) there's about 100 components for eri, so that's going to be excessive multiplied by all the operators and (b) there's a lot of redundancy (e.g., --enable-g12 provides cgtg, cgtg_x_coulomb, delcgtg2).

Am I thinking about this right? I don't prefer to have them diverge, but it might be that your proposal is right for l2::supports but not for the cmake components role.

@loriab loriab mentioned this pull request Oct 31, 2023
@loriab
Copy link
Collaborator Author

loriab commented Nov 2, 2023

Ok, I'm still not clear on your plan for the non-eri components. But since components aren't being used at all at the moment, perhaps rolling out eri now for a trial and revisiting the full set of non-eri later is ok? To that end, I made some edits so that the present components are consistent with the future expansion.

  • multipole gets 2-center and deriv, so now multipole_hh_dD
  • onebody gets 2-center, so now onebody_hh_dD
  • g12 gets 4-center, so now g12_hhhh_dD

Does that seem good, or do you want me to alias the operators in l2::supplies (e.g., user queries for yukawa_hh_d0, and fn looks up eri_hh_d0)?

I've added a little generation script for the components. Input is crude, but I didn't want it too fancy since it'll be fed by cmake later on.

I also tweaked some shorderings comments in engine.h

@evaleev
Copy link
Owner

evaleev commented Nov 2, 2023

  • multipole gets 2-center and deriv, so now multipole_hh_dD
  • onebody gets 2-center, so now onebody_hh_dD
  • g12 gets 4-center, so now g12_hhhh_dD

Does that seem good, or do you want me to alias the operators in l2::supplies (e.g., user queries for yukawa_hh_d0, and fn looks up eri_hh_d0)?

probably too much ... this functionality is for experts, who presumably will read the dox. Enough to state in the dox that eri implies general Boys function-based evaluation of integrals over distance-dependent 2-particle interactions and can be used to compute Yukawa, Slater, erf-attenuated Coulomb, etc.

I've added a little generation script for the components. Input is crude, but I didn't want it too fancy since it'll be fed by cmake later on.
I also tweaked some shorderings comments in engine.h

Great, thank you!

I'll have one final lookover, but this is good to go in my opinion.

Comment on lines 51 to 54
for am in range(eri3_max_am[deriv], 1, -1):
for am2 in range(max_am[deriv], 1, -1):
if am2 >= am:
centers = amstr[am].lower() * 2 + amstr[am2].upper()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to switch these to {max_am}{max_am}{eri3_max_am}. Apparently I had it right in my head (from you) when writing INSTALL.md but switched it around by the time I wrote the script.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 3171be8

Copy link
Collaborator Author

@loriab loriab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a couple more typos and changes for your upcoming review. Otherwise, lgtm.


#### Configuration Codes

Evenually, these will be CMake Components, too.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Evenually, these will be CMake Components, too.
Eventually, these will be CMake Components, too.

@@ -4,17 +4,24 @@
Following is a brief summary of changes made in each release of Libint.

- 2022-xx-yy: 2.8.0-beta.1
- UNMERGED PR #270: For Windows, basis sets with a star have been renamed to "s" on the filesystem,
- UNMERGED PR #271: Add `libint2::configuration_accessor` and `libint2::supports` functions. If
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- UNMERGED PR #271: Add `libint2::configuration_accessor` and `libint2::supports` functions. If
- PR #271: Add `libint2::configuration_accessor` and `libint2::supports` functions. If

- UNMERGED PR #270: For Windows, basis sets with a star have been renamed to "s" on the filesystem,
- UNMERGED PR #271: Add `libint2::configuration_accessor` and `libint2::supports` functions. If
library source is patched, these provides codes for what integrals a library instance can supply.
- UNMERGED PR #271: Small pkgconfig and cmake detection improvements. Enable unity build.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- UNMERGED PR #271: Small pkgconfig and cmake detection improvements. Enable unity build.
- PR #271: Small pkgconfig and cmake detection improvements. Enable unity build.

@@ -4,17 +4,24 @@
Following is a brief summary of changes made in each release of Libint.

- 2022-xx-yy: 2.8.0-beta.1
- UNMERGED PR #270: For Windows, basis sets with a star have been renamed to "s" on the filesystem,
- UNMERGED PR #271: Add `libint2::configuration_accessor` and `libint2::supports` functions. If
library source is patched, these provides codes for what integrals a library instance can supply.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
library source is patched, these provides codes for what integrals a library instance can supply.
library source is patched, these provide codes for what integrals a library instance can supply.

Copy link
Owner

@evaleev evaleev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the delay, wanted to update the wiki but will do in another PR

@evaleev evaleev merged commit 10ca429 into evaleev:master Nov 24, 2023
8 checks passed
@loriab loriab deleted the targetsconfig branch November 24, 2023 23:24
@evaleev
Copy link
Owner

evaleev commented Nov 25, 2023

weird, the merge master, even though the branch built fine: 10ca429 nvm, code in #279 needs to be skipped (or updated) if Gaussian solid harmonic ordering is used

evaleev added a commit that referenced this pull request Nov 25, 2023
@loriab loriab mentioned this pull request Feb 9, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CMake unconditionally installs libint2.pc into lib/pkgconfig pkgconfig: libint2.7 lacks version information
2 participants