COSX Reformulation for Negative Grid Weights - #2931
Conversation
| for (int ipoint = 0; ipoint < init_block->npoints(); ++ipoint) { | ||
| if (w[ipoint] < 0.0) { | ||
| throw PSIEXCEPTION("The definition of the current initial grid includes negative weights. As these are not suitable for the COSX implementation, please choose another initial grid through adjusting either COSX_PRUNING_SCHEME or COSX_SPHERICAL_POINTS_INITIAL."); | ||
| outfile->Printf(" WARNING: The definition of the current initial grid includes negative weights, which the original COSX formulation does not support!\n If this is of concern, please choose another initial grid through adjusting either COSX_PRUNING_SCHEME or COSX_SPHERICAL_POINTS_INITIAL.\n\n"); |
There was a problem hiding this comment.
I think this should not be a WARNING but INFO (does this exist in Psi4?)
There was a problem hiding this comment.
I'm happy to switch to INFO, but Psi4 seems to trend towards using WARNING instead of INFO for printout like this, at least from my observation.
There was a problem hiding this comment.
Added! I'll leave the conversation open, though, in case others want to comment on INFO vs. WARNING.
There was a problem hiding this comment.
I think this should not be a WARNING but INFO (does this exist in Psi4?)
There's no proper logging from c-side. :-( Only PSIEXCEPTION that stops execution and Printf("WARNING/INFO/ETC that goes to the output file. Admittedly not great. I don't think the situation has been seriously examined for improvement since pybind11 (and having python on the outside of psi4) was young.
in case others want to comment on INFO vs. WARNING.
I agree it's probably INFO at this point (rounding the grid up to down to a pure-positive one would be WARNING), but there's not standardization.
There was a problem hiding this comment.
I think this should not be a WARNING but INFO (does this exist in Psi4?)
There's no proper logging from c-side. :-( Only
PSIEXCEPTIONthat stops execution andPrintf("WARNING/INFO/ETCthat goes to the output file. Admittedly not great. I don't think the situation has been seriously examined for improvement since pybind11 (and having python on the outside of psi4) was young.in case others want to comment on INFO vs. WARNING.
I agree it's probably INFO at this point (rounding the grid up to down to a pure-positive one would be WARNING), but there's not standardization.
All good to know! Maybe such logging is something that could be more seriously looked at in the future. It wouldn't be a bad functionality to have.
susilehtola
left a comment
There was a problem hiding this comment.
Looks pretty good, please fix the issues above
Thanks for the review! I think everything you suggested should be covered now. |
375ea4d to
e7104df
Compare
| for (size_t p = 0; p < npoints_block; p++) { | ||
| for (size_t k = 0; k < nbf_block; k++) { | ||
| X_blockp[p][k] = point_values->get(p, k) * std::sqrt(w[p]); | ||
| X_block_nosignp[p][k] = point_values->get(p, k) * std::sqrt(std::fabs(w[p])); |
There was a problem hiding this comment.
| X_block_nosignp[p][k] = point_values->get(p, k) * std::sqrt(std::fabs(w[p])); | |
| X_block_nosignp[p][k] = point_values->get(p, k) * std::sqrt(std::abs(w[p])); |
|
I'm good with the way of computing the overlap matrix. One does want to use BLAS and this just means that you need an extra copy of the basis function value matrix. |
e0b332d to
eafaba2
Compare
Yeah, I was thinking it would be preferable to use BLAS, as well. |
|
So with #2955 (SplitJK) also being a thing, I think it would be preferable to get that one in first, and then rebase this one to adjust for the changes. |
3c0f816 to
7df2330
Compare
eb0635c to
0d2add3
Compare
1b6c258 to
9420930
Compare
9420930 to
1b5b26c
Compare
1b5b26c to
e82f036
Compare
ef8609d to
649b7c7
Compare
Co-authored-by: Susi Lehtola <susi.lehtola@alumni.helsinki.fi>
649b7c7 to
6397432
Compare
Description
This PR is a follow-up to #2906, and what can be considered an official solution to the issue discussed in #2890. The current issue is that COSX does not work with certain grid configurations - specifically, it does not work with grids that have negative grid weights, due to the use of an intermediate matrix in COSX that uses the square root of negative grid weights. #2906 "fixed" this issue by having COSX throw an exception when grids with negative weights were encountered. This PR provides a COSX reformulation that allows COSX to work with negative grid weights.
The reformulation does two primary things:
One other thing comes out as a consequence of this:
User API & Changelog headlines
Dev notes & details
Questions
linalg::doubletin thecompute_numeric_overlapfunction. One could probably do a slightly-modified, manually-implemented matrix multiply with the grid weight folded in, and constructtest_dfjcosk.pyfor a new grid weight option with negative weights. Unfortunately, it seems that other codes that have COSX just don't have grid options that lead to negative grid weights. For now, I've been comparing against Psi4 COSX calculations using similar grid sizes and ensuring the calculations have similar energies, but I certainly wouldn't consider that robust.Checklist
Status