-
Notifications
You must be signed in to change notification settings - Fork 22
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
Fix memory usage issue in evaluate_density
(#121)
#191
base: master
Are you sure you want to change the base?
Conversation
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.
Was it this simple? If so, we should look for other places in the code where the same trick can be used.
How did the performance change? I don't see any reason why this would be slower....
I think so! I didn't notice a performance hit. I wouldn't be surprised if it's faster. |
See #121 (comment). This doesn't make things better, as I found out when I did a real-time profile. |
It seemed to good to be true. The memory is that we evaluate all the orbitals on a grid first, and then form the density. This is not nearly as good an idea as evaluating directly from the density matrix. IF the density matrix is defined in terms of basis functions or localized orbitals, we can screen the evaluation. Realistically, this is to change everything. You will not evaluate the basis at first; instead you will, for each grid point, determine whether a given product of basis functions is significant. Once that is known, you will evaluate only the significant products of basis functions. The issue is going to be how to make this efficient given that a "for loop" over grid points is going to be terribly inefficient in Python. I can write some pseudocode for it, but the core issue is going to be making the operation efficient. The good news is that with this done, the cost will be proportional to the number of grid points (independent of the basis) and the memory requirement will be similar to the number of grid points also. It is not likely to be able to do this efficiently in the MO basis, so one can really only do this when |
With For a grid point that is where This equation can be solved exactly for For There are two roots, one near the nucleus (where d^2 is small) and one far out. The second root is the one we want, and has the value, (the same formula, but with the Lambert W function replacing the logarithm. We could solve for other values of The procedure then is to:
In the case where no screening is done, this amounts to a "chunked" version of the old algorithm I think. |
Fix memory usage issue in
evaluate_density
(#121) by using an optimizednp.einsum
.Checklist
Type of Changes
Related