-
Notifications
You must be signed in to change notification settings - Fork 82
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 method to Compound
that checks for overlapping particles
#1225
base: main
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 @@
## main #1225 +/- ##
==========================================
+ Coverage 84.85% 85.67% +0.81%
==========================================
Files 53 53
Lines 4800 4830 +30
==========================================
+ Hits 4073 4138 +65
+ Misses 727 692 -35 ☔ View full report in Codecov by Sentry. |
This includes a refactor of |
Here is a quick example. We're making a compound from 2 n-alkane molecules, and we want to make sure there aren't any particles within 0.20 nm of each other (a little less than the size of carbon radius).
If we use
If we use
If we use
This is a simple example where the use case probably isn't that useful, but controlling for |
PR Summary:
This is a small addition that adds a method to
Compound
that can check for overlapping particles (given a threshold distance). It uses scipy.spatial.distance.pdist, so it is pretty quick, although I haven't looked into performance with large compounds yet.Motivation: This would be a useful check to have when building molecules and other structures and checking for problem particles before taking the time to apply a forcefield and start a simulation. It will be helpful in some new polymer-building features we've been talking about.
One thing to consider: It might be useful to have an option to exclude directly bonded neighbors when doing this, since bond distances are often smaller than particle radii.
PR Checklist