Skip to content

Commit

Permalink
handle case when symbol is in all caps
Browse files Browse the repository at this point in the history
  • Loading branch information
mjohnson541 authored and rwest committed Jul 2, 2023
1 parent 7cee142 commit 5badbd1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arkane/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,11 @@ def get_element_mass(input_element, isotope=None):
number = input_element
elif isinstance(input_element, str):
symbol = input_element
number = next(key for key, value in symbol_by_number.items() if value == input_element)
try:
number = next(key for key, value in symbol_by_number.items() if value == input_element)
except:
symbol = input_element[0] + input_element[1].lower()
number = [key for key, value in symbol_by_number.items() if value == symbol][0]

if symbol is None or number is None:
raise ValueError('Could not identify element {0}'.format(input_element))
Expand Down

0 comments on commit 5badbd1

Please sign in to comment.