Skip to content

Speed/stability improvements to chemenv/coordination_environments#4546

Merged
shyuep merged 3 commits intomaterialsproject:masterfrom
lutfia95:pymatgen_PR4546
Nov 26, 2025
Merged

Speed/stability improvements to chemenv/coordination_environments#4546
shyuep merged 3 commits intomaterialsproject:masterfrom
lutfia95:pymatgen_PR4546

Conversation

@lutfia95
Copy link
Contributor

Summary

Major changes:

  • Deterministic neighbor ordering
  • O(1) lookups instead of linear scans
  • Fewer temporary allocations: Reuse lists; avoid building parallel arrays multiple times; prefer list appends over repeated concatenations.
  • Precomputation + tighter loops
  • Safer normalization
  • Serialization robustness
  • Minor consistency fixes

Performance notes

  • Fewer sorts
  • O(1) lookups for neighbor index mapping instead of O(n) scans inside inner loops
  • Reduced allocations in grouping and condition precomputation

Backward compatibility

  • No public API changes
  • All behavior is deterministic where previously order could vary across runs/platforms

Tests

All unit tests for chemenv/coordination_environments (same as before)

@shyuep
Copy link
Member

shyuep commented Nov 17, 2025

There seems to be merge conflicts. Pls merge the master branch into your fork and fix the conflicts. Thanks.

lutfia95 and others added 2 commits November 23, 2025 14:17
Signed-off-by: Ahmad Lutfi <62063481+lutfia95@users.noreply.github.com>
@shyuep shyuep merged commit 3284e75 into materialsproject:master Nov 26, 2025
40 of 44 checks passed
@pbenner
Copy link

pbenner commented Dec 8, 2025

Thanks Ahmad! Nice to see that your efforts are now accepted!

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.

3 participants