-
Notifications
You must be signed in to change notification settings - Fork 467
Omega Combine #1911
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
Omega Combine #1911
Conversation
btw some functionals use several range separation constants, could this be already supported in this PR or should it wait? |
@susilehtola Multiple coefficients, exponential constants, and weights is not supported in this PR. You should wait. |
psi4/src/psi4/lib3index/dfhelper.cc
Outdated
m1Ppq_ = std::unique_ptr<double[]>(new double[big_skips_[nbf_]]); | ||
|
||
if (!wcombine_) Ppq_ = std::unique_ptr<double[]>(new double[big_skips_[nbf_]]); |
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.
Small nitpick: could you switch these constructors (here and the following) to use make_unique
instead?
Ppq_ = std::make_unique<double[]>(big_skips_[nbf_]);
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.
I will be making the changes. Someone might want to take a look at the rest of dfhelper.cc to make this change to another group of unique_ptr
's. I don't know what all the rest of the code does, so I don't think I should submit those changes in this PR.
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.
I ended up making changes only to functions touched by this PR. I'll leave the other functions to people who know what to do with them.
rebase will fix CI |
…y Simmonet. Currently works inside rhf only.
…cc. Puts all exchange inside the wK_ matrix
…y Simmonet. Currently works inside rhf only. fixes merge conflicts in libscf_solver/rhf.cc
"fixes merge conflicts in hf, jk, and dfhelper code."
fixes bad function again in dfhelper.h
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.
Just to check, the memory estimator correctly accounts for this new mode of operation?
Also can you recommend specific tests for this?
psi4/src/psi4/libscf_solver/uhf.cc
Outdated
@@ -208,7 +207,7 @@ void UHF::form_G() { | |||
double alpha = functional_->x_alpha(); | |||
double beta = functional_->x_beta(); | |||
|
|||
if (alpha != 0.0) { | |||
if ( alpha != 0.0 && !(functional_->is_x_lrc() && jk_->name() == "MemDFJK" && jk_->get_wcombine()) ){ |
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.
It might be best if jk_->wcombine()
or similar is for every JK object which normally returns false. This could be useful for Direct as well.
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 memory checker does make the correct estimation based on this new operation.
As far as testing it goes, the only way would be to set the memory in the test script and to make sure that psi gives back the right value, but that could be problematic if someone messes with the fudge factor and gibi vs. giga bytes.
The complicated logic in that if statement is necessary because there are conditions that can be taken for granted without wcombine that can't without it.
It would be useful for direct, but I wanted to wait on the libint2 branch to get sorted before I did anything with that.
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.
I'm not suggesting that you implement it into Direct at the moment, but more of the point that jk_->name() == "MemDFJK" && jk_->get_wcombine()
is a leaky abstraction and creates a headache throughout the code. This get_wcombine
should be native to the JK base object and return false for all classes where this isn't implemented.
Otherwise if you add this to direct we will need to add additional logic to every instance where you wrote this.
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.
jk_->get_wcombine()
will already return false for all classes that aren't MemDFJK
as you've suggested. I included the condition jk_->name() == "MemDFJK"
because I didn't think I would need the !jk_->get_wcombine()
case when I started working on the code. This isn't an attempt at short-circuiting as it appears to be.
I'm going to try getting rid of the jk_->name() == "MemDFJK"
condition. If I understand the code correctly, it should work.
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.
I made the change and tested it. It seems to be working just fine.
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.
fyi, commit message would more precisely say "condition" than "conditional"
Looks good, thanks for the changes. |
Description
Calculates exchange terms in a single tensor rather than contracting and adding. Reduces the cost of contractions against SCF coefficients in range separated DFT.
Changes the working equation for calculating the coulomb matrix in range separated DFT calculations. This lowers the number of tensors that Psi4 needs to store, reducing memory costs and extending the number of cases operable by DFHelper.
Todos
Notable points (developer or user-interest) that this PR has or will accomplish.
Questions
Checklist
Status