Skip to content

Use set operations for unique atom detection in HybridTopologyFactory#1911

Closed
kokishimada wants to merge 2 commits intoOpenFreeEnergy:mainfrom
kokishimada:optimize-unique-atom-detection
Closed

Use set operations for unique atom detection in HybridTopologyFactory#1911
kokishimada wants to merge 2 commits intoOpenFreeEnergy:mainfrom
kokishimada:optimize-unique-atom-detection

Conversation

@kokishimada
Copy link
Copy Markdown

Summary

  • Replace linear-scan loops with set difference operations in HybridTopologyFactory._set_mappings for finding unique atoms
  • Use dict comprehension for _env_old_to_new_map construction

Test plan

  • Existing tests for HybridTopologyFactory pass
  • Verify _unique_old_atoms and _unique_new_atoms produce the same sorted results as before

Replace linear-scan loops with set difference operations in
_set_mappings for finding unique atoms and environment atom maps.
Also use dict comprehension for _env_old_to_new_map construction.
Reuse the result already stored in new_bond_parameters instead of
calling _find_bond_parameters a second time with the same arguments.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

No API break detected ✅

@IAlibay
Copy link
Copy Markdown
Member

IAlibay commented Apr 1, 2026

Hi @kokishimada - thanks for opening this PR, this is very interesting.

That being said, there is already some work towards speeding up the HTF being done here: #1858

It's possible that we would go for that PR instead, but I will let @jthorton weigh in.

@kokishimada kokishimada closed this by deleting the head repository Apr 16, 2026
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