Skip to content

Commit

Permalink
Discriminate between cases where the monoisotopic form is specified d…
Browse files Browse the repository at this point in the history
…irectly, or by neutron reference
  • Loading branch information
mobiusklein committed Nov 25, 2023
1 parent 60fad15 commit efcfe8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/brainpy/_c/composition.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,15 @@ cdef void _isotopes_of(char* element_symbol, IsotopeMap** isotope_frequencies):

freqs = dict()
py_element_symbol = PyStr_FromString(element_symbol)

try:
element_data = nist_mass[py_element_symbol]
except KeyError:
element_data = nist_mass[py_element_symbol.encode('utf-8')]

for i, mass_freqs in element_data.items():
if i == 0:
mono_neutrons = PyInt_AsLong(mass_freqs[0])
if isinstance(mass_freqs, int):
mono_neutrons = PyInt_AsLong(mass_freqs[0])
continue
if mass_freqs[1] > 0:
freqs[i] = mass_freqs
Expand Down

0 comments on commit efcfe8a

Please sign in to comment.