Skip to content

Commit

Permalink
Merge pull request #28 from pckroon/fix_27
Browse files Browse the repository at this point in the history
Fix 27
  • Loading branch information
pckroon committed Jul 27, 2023
2 parents d4813a7 + b1052eb commit 077f254
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pysmiles/smiles_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ def format_atom(molecule, node_key, default_element='*'):
if aromatic:
name = name.lower()

if (stereo is None and isotope == '' and charge == 0 and default_h and
class_ == '' and name.lower() in 'b c n o p s se as *'.split()):
if (stereo is None and isotope == '' and charge == 0 and default_h and class_ == '' and
(name.lower() in 'b c n o p s *'.split() or name in 'F Cl Br I'.split())):
return name

if hcount:
Expand Down
10 changes: 10 additions & 0 deletions tests/test_write_smiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@
[],
dict(explicit_hydrogen=False, zero_order_bonds=False, reinterpret_aromatic=True),
),
(
[(0, {'element': 'Se', 'charge': 0, 'aromatic': False, 'hcount': 0})],
[],
False
),
(
[(0, {'element': 'As', 'charge': 0, 'aromatic': False, 'hcount': 0})],
[],
False
),
))
def test_write_smiles(node_data, edge_data, kwargs):
mol = make_mol(node_data, edge_data)
Expand Down

0 comments on commit 077f254

Please sign in to comment.