Skip to content

Commit

Permalink
modified guess_atom_element for more accurate guess
Browse files Browse the repository at this point in the history
  • Loading branch information
pillose committed Jun 14, 2023
1 parent 58bbc44 commit 921616b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion package/MDAnalysis/topology/guessers.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,12 @@ def guess_atom_element(atomname):
except KeyError:
# strip symbols and numbers
no_symbols = re.sub(SYMBOLS, '', atomname)
name = re.sub(NUMBERS, '', no_symbols).upper()
no_numbers = re.split(NUMBERS, no_symbols)

if list(filter(None, no_numbers)) == []:
name = ''
else:
name = list(filter(None, no_numbers))[0].upper()

# just in case
if name in tables.atomelements:
Expand Down

0 comments on commit 921616b

Please sign in to comment.