biotite
biotite copied to clipboard
Improve distance calculation speed for small systems
The current implementation of various functions (i.e. RDF) uses a cell list approach to calculate distances between two selections. However, this approach tends to be very slow for some edge cases such as:
- systems with low number of particles
- if one of the two selections is very small
In these cases, a bruteforce based approach is usually faster. It would be nice if biotite had some heuristic to switch between the two methods based on the given problem.
To find a good heuristic might be quite challenging, but I will start with an optional use_cell_list
parameter.
This PR should fix the issue for the rdf()
function. All other currently implemented functions, that use a CellList
always need a large number of pairwise distances, so a brute-force witch is not required in those cases, in my opinion. Furthermore, PR #311 also increases the performance of the cell list based approach.