-
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
Add tests for density evaluations #94
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #94 +/- ##
=======================================
Coverage 99.64% 99.64%
=======================================
Files 28 28
Lines 1408 1408
Branches 324 324
=======================================
Hits 1403 1403
Misses 4 4
Partials 1 1 ☔ View full report in Codecov by Sentry. |
There already is a test that compares density evaluation with horton, but the density matrix used was an identity matrix. Just in case, the density evaluations are compared for both spherical and cartesian contractions for random symmetric density matrix.
@maximilianvz I just invited you to |
@FarnazH, I have taken a look at this PR, and while there are obvious, easy changes to be made regarding In the state of the repo at the time that this PR was made, the assertions pass fine. However, in the repo's current state, I'm guessing that, at some point in the 4.5 years since this PR was created, something about |
I looked into this and, if I checked this correctly, this test fails because the correct output has negative values and we are making those zero now (see gbasis/gbasis/evals/density.py Line 96 in 466ec1f
Based on the PR, looks like the reference data comes from Horton, using a "random symmetric density matrix". I am not sure what this random means here, if it is not physically relevant, meaning if a "not random" symmetric density matrix is used we are not going to have this large negative values. From what I know density can not be negative and that is why we were filtering the output for those numbers. @FarnazH, @PaulWAyers any insights into this would be good to see if we should keep this test or not. |
I think the test should use a DM from a data file. We should also only test positive density values, though we should test that the correct behavior is observed for negative density values too. The other choice is to build an ANO-centric example along the lines I recommended elsewhere. |
horton_density = np.load(find_datafile("data_horton_hhe_cart_density_rand.npy")) | ||
density_matrix = np.load(find_datafile("data_horton_hhe_cart_dm_rand.npy")) |
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.
This tests against HORTON (based on these test files included in the repo), so I don't understand why a random density matrix is used. @maximilianvz, can you update this test and its files to use a real example?
@marco-2023 there is an |
Steps
Description
There already is a test that compares density evaluation with horton, but the
density matrix used was an identity matrix. Just in case, the density
evaluations are compared for both spherical and cartesian contractions for
random symmetric density matrix.
There were some suspicions that either the density evaluations or the orbital evaluations are giving the wrong results. This PR confirms that the density evaluations are correct (at least in comparison to HORTON).
Type of Changes
Related Issue
Depends on PR #93.