Skip to content

Speed up symmetry functions with faster is_periodic_image algorithm #4433

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

Merged
merged 3 commits into from
Jun 8, 2025

Conversation

kavanase
Copy link
Contributor

@kavanase kavanase commented Jun 7, 2025

I noticed that in some of our doped testing workflows, SpacegroupAnalyzer.get_primitive_standard_structure() is one of the main bottlenecks (as to be expected). One of the dominant cost factors here is the usage of is_periodic_image, which can be expensive for large structures due to many np.allclose() calls.
This PR implements a small change to instead use an equivalent (but faster) pure Python loop, which also breaks early if the tolerance is exceeded.

In my test case, this reduced the time spent on is_periodic_image (and thus SpacegroupAnalyzer.get_primitive_standard_structure()) from 35s to 10s.

@kavanase kavanase requested review from shyuep and mkhorton as code owners June 7, 2025 18:32
@shyuep shyuep merged commit 5a4046b into materialsproject:master Jun 8, 2025
44 checks passed
@shyuep
Copy link
Member

shyuep commented Jun 8, 2025

Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants