Skip to content

Minor clean up in SMILES Writing double bond canonicalization#8971

Merged
greglandrum merged 3 commits intordkit:masterfrom
ricrogz:smiles_write_cleanup_1
Dec 3, 2025
Merged

Minor clean up in SMILES Writing double bond canonicalization#8971
greglandrum merged 3 commits intordkit:masterfrom
ricrogz:smiles_write_cleanup_1

Conversation

@ricrogz
Copy link
Copy Markdown
Contributor

@ricrogz ricrogz commented Nov 26, 2025

As I look through SMILES writing code for #8968, I'm noticing some things that can be cleaned up. In this PR I'm suggesting some minor refactors with no functional change:

  • Move the firstVisitOrder declaration/reset into the findNeighborBonds lamba, since it's only used there, and it needs to be reset before each usage.
  • Remove one extra bond switch in the ! setFromBond1 branch. This makes the E/TRANS/Z/CIS decision more intuitive, and also makes it simillar to the one in the other branch, making it easier to abstract into a separate function in a future refactor.
  • Remove the atomBonds variable by modernizing the loop where it is uses.

@ricrogz ricrogz added the Cleanup Code cleanup and refactoring label Nov 26, 2025
Copy link
Copy Markdown
Member

@greglandrum greglandrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@greglandrum greglandrum added this to the 2025_09_4 milestone Dec 3, 2025
@greglandrum greglandrum merged commit 39c4083 into rdkit:master Dec 3, 2025
12 checks passed
@ricrogz ricrogz deleted the smiles_write_cleanup_1 branch December 3, 2025 16:42
greglandrum pushed a commit that referenced this pull request Dec 30, 2025
* move firstVisitOrder into lambda

* remove extra bond switch

* modernize loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cleanup Code cleanup and refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants