Skip to content
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 sparse grid tests #843

Merged
merged 1 commit into from
Oct 10, 2024
Merged

Fix sparse grid tests #843

merged 1 commit into from
Oct 10, 2024

Conversation

pfebrer
Copy link
Contributor

@pfebrer pfebrer commented Oct 10, 2024

This PR handles the previous problems that the sparse grid had when reducing orbital products because of a mismatch in nsc between the orbital values and weights (e.g. DM). This resulted in trying to access arrays outside of their memory. This PR:

  • Introduces a check to see if the shape of the weights array provided is consistent with the nsc of the sparse grid.
  • When computing the density from the DM, adds a check to set nsc of the matrix to the sparse grid one.
  • Added the possibility of truncating the orbital values in the sparse grid with the nsc of the geometry. This is done by an extra truncate_with_nsc argument in Geometry._orbital_values.
  • Change the nsc in sparse grid tests so that it works.
  • Reset pre-compute as the default method for density computation, since it is 100x faster (note: I think the direct method could be optimized to be a bit faster).

Copy link

codecov bot commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.

Project coverage is 87.06%. Comparing base (0cc03dc) to head (55dead8).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/sisl/_core/geometry.py 50.00% 2 Missing ⚠️
src/sisl/_sparse_grid.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #843      +/-   ##
==========================================
+ Coverage   86.68%   87.06%   +0.37%     
==========================================
  Files         402      402              
  Lines       51887    51894       +7     
==========================================
+ Hits        44980    45180     +200     
+ Misses       6907     6714     -193     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/sisl/_core/geometry.py Outdated Show resolved Hide resolved
@zerothi zerothi merged commit 3e9e00a into zerothi:main Oct 10, 2024
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants