-
Notifications
You must be signed in to change notification settings - Fork 728
Description
Is your feature request related to a problem?
In the review of PR #4092 , @richardjgowers observed that there's an opportunity for improving the performance for the "between" keyword of HydrogenBondAnalysis #4092 , namely to filter atomgroups for "between" before capped_distances()
is called to calculate distances.
Describe the solution you'd like
Follow up on the suggestion and implement the suggested improvement and benchmark the old code vs the updated one.
Describe alternatives you've considered
Do nothing — that's fine, the update is not mission-critical.
Additional context
Discussion #4092 around
if self.between_ags is not None: |
-
@richardjgowers : [...] would it make more sense to filter before the call to capped_distances?
d_a_indices, d_a_distances = capped_distance( -
@p-j-smith : good point - that would definitely be better, but it's probably not a straightforward change and I imagine there are lots of ways to do it. One way would be to iterate over the pairs of atom selections passed to
between
and calculate donor-acceptor distances for each pair. So e.g. ifbetween=[["protein", "SOL"], ["protein", "protein"]]
, we would calculate:- protein donor to SOL acceptor distances
- protein acceptor to SOL donor distances
- protein donor to protein acceptor distances
and concatenate them.