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

sparse grid ao along (0,2) axes #114

Merged
merged 2 commits into from
Oct 10, 2023
Merged

Conversation

blazejba
Copy link
Contributor

@blazejba blazejba commented Oct 3, 2023

When ao_threshold arg is specified, it reduces the grid size, if any slices along this axis are all zeros. The reduced grid_size applies to grid_AO, grid_coords, and grid_weights.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@blazejba blazejba requested a review from AlexanderMath October 9, 2023 14:09
@@ -160,7 +160,7 @@
" \n",
" for line in output.split(\"\\n\"):\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we check if the unit [eV] was correct (or if it should be [meV])? I think it'd be neat to have a cut-off around 42meV (chemical accuracy). If the units are [eV] then we're probably sparsifying a bit too much (150eV error is >1000x worse error than ML models).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the unit was correct. The high error we saw was for 32 carbon atoms placed in a line - the error for placing atoms in a line is high regardless of the grid sparsification (c_32 on the graph).

image

grid_AO_dm = grid_AO[0] @ density_matrix # (gsize, N) @ (N, N) -> (gsize, N)
grid_AO_dm = jnp.expand_dims(grid_AO_dm, axis=0) # (1, gsize, N)
grid_AO_dm = grid_AO[0] @ density_matrix # (gsize, N) @ (N, N) -> (gsize, N)
grid_AO_dm = jnp.expand_dims(grid_AO_dm, axis=0) # (1, gsize, N)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing we can use the same code for this!

@@ -199,10 +199,18 @@ def init_dft_tensors_cpu(mol, opts, DIIS_iters=9):
grid_weights = grids.weights # (grid_size,) = (45624,) for C6H6
coord_str = 'GTOval_cart_deriv1' if mol.cart else 'GTOval_sph_deriv1'
grid_AO = mol.eval_gto(coord_str, grids.coords, 4) # (4, grid_size, N) = (4, 45624, 9) for C6H6.
if opts.ao_threshold is not None:
if opts.ao_threshold > 0.0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really like the simplicity: we just pre-process remove and only change grid_size so exchange_correlation code remains the same!

@blazejba blazejba force-pushed the bb/low-hanging-sparse-grid-ao branch from b26931d to cd2b2d5 Compare October 10, 2023 09:03
@blazejba blazejba merged commit 39527d5 into main Oct 10, 2023
4 checks passed
@blazejba blazejba deleted the bb/low-hanging-sparse-grid-ao branch October 10, 2023 09:20
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