Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds some optimizations and shortcuts for periodic image site detection that can be used in certain applications.
The optimizations are two-fold:
Currently, the periodic image check checks the lattice vectors of parent cell, species and position of a site and its potential image. For situations where the image checker is working with a fixed lattice, no overlapping sites, i.e., when performing a voronoi decomposition of a given cell, then these checks can be made optional. As these checks are wrapped in Python object niceties there can be quite a significant overhead from performing them, the composition check in particular (my benchmarks indicated ~30% of time when looping over a structure is just checking these compositions).
Secondly, the actual fractional coordinate diff can be optimized by replacing the element-wise tolerance check with a tolerance on an
L1
norm (orL2
, if desired). The default tolerance could be tweaked slightly to adjust for this.Todo (if any)
Report back with a proper benchmark
Checklist
Work-in-progress pull requests are encouraged, but please put [WIP] in the pull request title.
Before a pull request can be merged, the following items must be checked:
mypy path/to/file.py
to type check your code.