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
NeighborList Filters and SANN #1051
Conversation
for more information, see https://pre-commit.ci
Co-authored-by: Domagoj Fijan <50439291+DomFijan@users.noreply.github.com>
Co-authored-by: Domagoj Fijan <50439291+DomFijan@users.noreply.github.com>
Co-authored-by: Vyas Ramasubramani <vramasub@umich.edu>
RDF Normalization Mode Argument
Originally the implementation that Simon, Bradley and I considered was based on iteratively performing ball queries until a sufficient number of neighbors was found to complete the sphere. I'm on board with the current approach of filtering, which circumvents some of the implementation complexity associated with that iterative procedure by pushing the burden of having an effective starting point onto the user, but I think we probably should help out users a bit more than we are now. In that vein, a few points:
|
Indeed. Users should use replication in small N, high density systems. For low density systems of any N, users should not use SANN at all. I presented that possibility above as a pathological case to demonstrate that is is not feasible to find a complete SANN list for any arbitrary system the user might provide, even with massive numbers of system replicates and using all pairs. One could probably formulate a rule of thumb for the search radius needed in terms of the mean free path. |
I am on board with adding an extra argument as @vyasr suggested, and I think an error should be the default behavior. If we are going to have an iterative procedure for finding a good choice of query parameters, it will be necessary to have the ability to generate an error in I think the best iterative procedure would be a binary search with either |
I have added the code to raise an error if there are unfilled neighbor shells. I cannot, however, figure out how to get the error message to format properly when the exception is raised. Here is an example of what the user sees right now when the exception is raised:
Does anyone know how to get exceptions from C++ to format nicely in python output? |
pybind11 translates c++ exceptions to Python ones :) |
Cython also translates C++ exceptions to Python ones :) All that you should need is the |
@tommy-waltmann I cannot reproduce that traceback locally. If I set |
Do @b-butler or anyone else have more comments on this PR? |
Given the large discussion is another opinion warranted you think @tommy-waltmann? |
Just making sure everyone who is tagged for review gets a chance to provide their opinion. |
Description
This PR adds a new concept in freud, the NeighborList filter, and the SANN neighbor finding method implemented as a neighborlist filter. The SANN method finds neighbors based on solid angle occupied by each neighbor up to a total of 4pi. For more information, see https://aip.scitation.org/doi/10.1063/1.4729313
I have also added a method for sorting a
NeighborList
by either distance or point_index to the python API. It was needed for the SANN method implementation and I think it has general utility as well.Motivation and Context
This is a useful way of finding neighbors, which was not previously available in freud.
How Has This Been Tested?
Tests have been added in
test_locality_Filter.py
. I would like to see some validation of the calculation on a real system before this PR can be merged.Types of changes
Checklist: