-
Notifications
You must be signed in to change notification settings - Fork 467
Density Screening Refactor Part 2: Implementation of shell_significant() #2695
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
Density Screening Refactor Part 2: Implementation of shell_significant() #2695
Conversation
235d939
to
566ba18
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I left some comments. Namely, my biggest concern is about removing the screening density
keyword and moving update_density
away from TwoBodyAOInt
. I think it would make more sense to get it all done in one PR, but that is my personal opinion.
@@ -77,7 +77,7 @@ TwoBodyAOInt::TwoBodyAOInt(const IntegralFactory *intsfactory, int deriv) | |||
else if (screentype == "CSAM") | |||
screening_type_ = ScreeningType::CSAM; | |||
else if (screentype == "DENSITY") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to diable setting screening density
altogether?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason this is still in here is to account for cases where density screening is used in the HF step and another form of screening is used through TwoBodyAOInt for a later step in the calculation. Looking through the code, it seems that an example of this is in the DirectJKGrad class, which uses TwoBodyAOInt screening functions in its tests for shell block significance.
This will certainly be removed once density screening is separated out as a keyword, though.
// The density screened ERI bound (Eq. 6) | ||
return (mn_mn * rs_rs * max_density * max_density >= screening_threshold_squared_); | ||
} | ||
double TwoBodyAOInt::shell_pair_max_density(int i, int M, int N) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move shell_pair_max_density
to JK in this PR or the next? I don't think this belongs in TwoBodyAOInt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My plan was to move this whenever update_density gets moved, which I'm planning on being the next PR.
Thank you very much for the comments! I do appreciate it. As for your points, my thought was to implement both of these changes in future PRs, maybe as a single future PR, maybe as their own separate ones. I think there's a good argument to be made for making a separate option for density screening in this PR, and I'd be quite willing to do that. But, I do believe that removing update_density should be its own PR, as that PR would consist of removing ALL references to the density matrix from TwoBodyAOInt, and I think it would be easier to review and clearer intent if update_density was separated out in its own PR. |
@@ -1111,7 +1118,7 @@ void PKMgrYoshimine::compute_integrals(bool wK) { | |||
for (size_t j = 0; j <= i; ++j) { | |||
int RR = sh_pairs[j].first; | |||
int SS = sh_pairs[j].second; | |||
if (tb[thread]->shell_significant(PP, QQ, RR, SS)) { | |||
if (shell_significant(PP, QQ, RR, SS)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so why does this no longer get applied per-thread? (read as naive, not insightful, question)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shell_significant function in PKMgrYoshimine is defined to do its shell significance test using the sieve_ variable in the base PKManager class instead of through the TwoBodyAOInt object. Theoretically, shell_significant in PKMgrYoshimine could be redefined to use tb[thread]'s shell_significant definition, though it would be somewhat clumsy since it would require passing { tb[thread] } (or something like that, basically just a vector with only tb[thread] in it) as the optional argument for int.
Talking about it here though makes me wonder whether using sieve_ is the best approach for the shell_significant definition, however. I tested it a while back when I first implemented it, and the screened shell quartet counts matched up between this PR's implementation and the previous one, but I really may want to recheck that for my own sake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ERISieve class is deprecated in favor of having the TwoBodyAOInt
object do the sieving. This was originally decided as part of the L2 discussion and has been reaffirmed on Slack just a week or two ago. I was in the process of getting rid of ERISieve when this PR came up.
We'll need to agree about the future of "what class is responsible for sieving" before this PR can be merged in.
|
I did indeed notice that! I think I know the problem, so I will apply the fix in just a little bit. |
All right, CI issue should be fixed now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking this PR until we can resolve the question of "is TwoBodyAOInt
responsible for sieving, or is ERISieve
"? Happy to talk about this after ACS Chicago.
To add an update to this, some of us (Jonathan, I, and others) discussed this issue at PsiCon 2022. We came to the conclusion that TwoBodyAOInt would be responsible for sieving, and that ERISieve will be removed from Psi4. As use of ERISieve is seemingly localized to the PKJK algorithm, I will be the one responsible for its removal. Until then, this PR will likely be further delayed. |
ad4722e
to
bdf3073
Compare
Co-authored-by: Andy Jiang <60559795+andyj10224@users.noreply.github.com>
This reverts commit b6d1def.
47e0c21
to
98c7008
Compare
@davpoolechem Since #3098 has been opened, should we close this PR? |
You are correct, we should! And so I will. |
Description
This PR is the second in a series of planned PRs designed to remove density screening from the TwoBodyAOInt object and into the JK object, with PR #2547 being the first such PR. Having density screening available in TwoBodyAOInt runs the risk of applying density screening to algorithms where density screening doesn't make sense. Thus, it would be a good idea to move the logic of density screening to where it is more correctly applied, i.e., the JK object.
The primary purposes of this PR are twofold:
Notes
I wanted to outline what the next steps were for this chain of PRs, since this one accomplishes one of the main goals of the refactor in the first place:
Todos
Questions
Checklist
Status