Skip to content

Conversation

@davpoolechem
Copy link
Contributor

@davpoolechem davpoolechem commented Nov 7, 2022

Description

The goal of this PR is to expand test coverage of the DFJCOSK and DFJLinK JK subclasses within Psi4 by including their testing within the scf5 test. The scf5 test in Psi4 tests a variety of combinations of SCF_TYPE and SCF reference for singlet and triplet O2. As it were, the COSX and LinK SCF_TYPES were missing from the list of methods analyzed within this test. This PR simply adds COSX and LinK to the list of methods tested in scf5, expanding testing of these two methods beyond what was previously present.

NOTE TO REVIEWERS: This PR is a general JK maintenance/cleanup/improvement PR and is independent of the developments occurring regarding CompositeJK and its direct implementation into Psi4.

User API & Changelog headlines

  • N/A

Dev notes & details

  • Adds COSX and LINK to the list of SCF_TYPEs tested in the scf5 test option.

Questions

  • Is the methodology by which COSX and LinK tested acceptable? Unfortunately, the reference energies used in scf5 are either canonical (i.e., non-DF) or DF, neither of which fully describe the COSX and LINK methods. The approach I took is to compare each COSX and LINK energy to the corresponding canonical energy with an atol of 1E-4. Any feedback on this particular approach to testing COSX and LINK would be appreciated.

Checklist

Status

  • Ready for review
  • Ready for merge

@TiborGY
Copy link
Contributor

TiborGY commented Nov 7, 2022

Would testing COSX results against the implementation in Orca 5 make sense? Of course the grid dependence makes such things tricky.

@davpoolechem
Copy link
Contributor Author

Would testing COSX results against the implementation in Orca 5 make sense? Of course the grid dependence makes such things tricky.

Practically speaking, this should be doable, but one would need to ensure that as many factors between the two implementations as possible are standardized and made the same. Some of these factors (e.g., screening tolerances) shouldn't be that hard, but others (like grids, as you mentioned) would be quite a bit harder and could be quite a thorn in our side for comparing the two implementations.

This question opens up the discussion to another approach I was thinking for this PR - using separate reference energies for COSX and LINK in the scf5 test, rather than comparing against canonical or DF energies. I am rather neutral on that matter, and am definitely open to doing so; but there are some concerns that should be considered with the separate reference energies approach. These are concerns that might not matter as much now; but the scf5 test will undoubtedly be expanded as CompositeJK and new separate J and K algorithms are added to Psi4, and these concerns might pop up then:

  1. Using separate reference energies for each CompositeJK JK build combination, for each O2 multiplicity and SCF reference, could quickly make scf5 quite unwieldy and messy.
  2. Against what do we compare reference energies? In some cases, it won't be too big of a problem (as with here, where we can compare against ORCA), but I'm willing to bet that there are certain combinations of J and K algorithms that CompositeJK will eventually be able to do, that might not actually be present in other codes to compare against.

Of course, these concerns are more specific to CompositeJK testing, so maybe they're an issue that can punted down the road for when scf5 gets updated again.

@loriab
Copy link
Member

loriab commented Nov 9, 2022

Is the methodology by which COSX and LinK tested acceptable? Unfortunately, the reference energies used in scf5 are either canonical (i.e., non-DF) or DF, neither of which fully describe the COSX and LINK methods. The approach I took is to compare each COSX and LINK energy to the corresponding canonical energy with an atol of 1E-4. Any feedback on this particular approach to testing COSX and LINK would be appreciated.

I think it'd be most useful to continue scf5 as a regression test. That is, record new refs for the in-between-conv-and-df algorithms collected at tight convergences, then check them against usual 6 decimal places. Then we'll know in future if code changes affect the algorithms.

How are you generating the samples/ files? If it's any other way than autogenerated via the docs build, please don't go to the trouble. We can catch the changes en masse before release.

@JonathonMisiewicz
Copy link
Contributor

I strongly agree with Lori about having this as a regression test rather than an accuracy test. Put the new, approximate energies with all the others. That should be a good indicator to others working with the SCF system of what accuracy to expect.

@davpoolechem
Copy link
Contributor Author

davpoolechem commented Nov 10, 2022

Is the methodology by which COSX and LinK tested acceptable? Unfortunately, the reference energies used in scf5 are either canonical (i.e., non-DF) or DF, neither of which fully describe the COSX and LINK methods. The approach I took is to compare each COSX and LINK energy to the corresponding canonical energy with an atol of 1E-4. Any feedback on this particular approach to testing COSX and LINK would be appreciated.

I think it'd be most useful to continue scf5 as a regression test. That is, record new refs for the in-between-conv-and-df algorithms collected at tight convergences, then check them against usual 6 decimal places. Then we'll know in future if code changes affect the algorithms.

How are you generating the samples/ files? If it's any other way than autogenerated via the docs build, please don't go to the trouble. We can catch the changes en masse before release.

I strongly agree with Lori about having this as a regression test rather than an accuracy test. Put the new, approximate energies with all the others. That should be a good indicator to others working with the SCF system of what accuracy to expect.

All right, sounds like a plan! I will do this, then!

Also, Lori, to answer your question about samples, I have been editing them manually. Thank you for letting me know about their autogeneration!

@davpoolechem
Copy link
Contributor Author

davpoolechem commented Nov 10, 2022

I did a couple more things here:

  1. At the suggestion of the reviewers, I added individual reference energies for the current composite methods (which were acquired at tight tolerances - 1e-10 for D and E convergence, and 1e-14 for ERI screening). The COSX and LinK methods now test against these corresponding reference energies at the normal 1e-6 atol.

  2. With 1) in mind, I made more sweeping changes as well. First, the reference energies are now kept in a dictionary rather than spread out across different variables. This improves readability and should facilitate the addition of new methods, Composite or otherwise, to the scf5 testing suite. Additionally, composite methods are tested in a loop per test case. This will facilitate the testing of new Composite methods added to Psi4, as will happen in the future.

@davpoolechem davpoolechem force-pushed the dpoole34/jk-test-coverage branch from 65f7c97 to 72ca2ff Compare November 10, 2022 18:12
Copy link
Member

@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.

lgtm, thanks for the expanded testing!

@loriab loriab added this to the Psi4 1.7 milestone Nov 10, 2022
@loriab loriab added testing scf Involves general SCF: convergence algorithms, RHF/UHF/ROHF/CUHF... labels Nov 10, 2022
@loriab loriab merged commit 6384381 into psi4:master Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scf Involves general SCF: convergence algorithms, RHF/UHF/ROHF/CUHF... testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants