diff --git a/rmgpy/molecule/molecule.py b/rmgpy/molecule/molecule.py index e93f0092eb..04230a0839 100644 --- a/rmgpy/molecule/molecule.py +++ b/rmgpy/molecule/molecule.py @@ -981,7 +981,20 @@ def __init__(self, atoms=None, symmetry=-1, multiplicity=-187, reactive=True, pr self.from_inchi(inchi) self._inchi = inchi elif smiles: - self.from_smiles(smiles) + if 'X' in smiles: + self.from_smiles(smiles.replace('X', 'Ar')) + lines = self.to_adjacency_list().split('\n') + for i, line in enumerate(lines): + if 'Ar' in line: + lines[i] = lines[i].replace('Ar', 'X') + # remove any extra electron pairs + lines[i] = lines[i].replace('p3', 'p0') + lines[i] = lines[i].replace('p2', 'p0') + lines[i] = lines[i].replace('p1', 'p0') + adj_list = '\n'.join(lines) + self = self.from_adjacency_list(adj_list) + else: + self.from_smiles(smiles) self._smiles = smiles if multiplicity != -187: # it was set explicitly, so re-set it (from_smiles etc may have changed it)