From ac39c9635955199269393e3c12e30a94e0001935 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Thu, 3 Oct 2024 15:21:08 -0400 Subject: [PATCH] fix: use rdkit API to remove implicit hydrogens (#2278) ## Summary by CodeRabbit - **New Features** - Enhanced SMILES conversion process with improved implicit hydrogen handling for atoms. - **Bug Fixes** - Removed outdated method that previously handled SMILES conversion, streamlining the conversion process. - **Tests** - Removed a test related to the now-removed SMILES handling method, reflecting updates in testing strategy. - **Chores** - Minor formatting adjustments and removal of unused imports for cleaner code. --------- Signed-off-by: Jinzhe Zeng --- reacnetgenerator/_path.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reacnetgenerator/_path.py b/reacnetgenerator/_path.py index 90a781284..2db071a6e 100644 --- a/reacnetgenerator/_path.py +++ b/reacnetgenerator/_path.py @@ -264,6 +264,10 @@ def convertSMILES(self, atoms, bonds): d[number] = m.AddAtom(Chem.Atom(name)) for atom1, atom2, level in bonds: m.AddBond(d[atom1], d[atom2], Chem.BondType(level)) + # https://github.com/rdkit/rdkit/discussions/6613#discussioncomment-6688021 + for a in m.GetAtoms(): # type:ignore + a.SetNoImplicit(True) + a.UpdatePropertyCache() name = Chem.MolToSmiles(m) return self._re(name)