JuliaPhysics / PeriodicTable.jl

Periodic Table for Julians! :fire:
Other
111 stars 26 forks source link

Adding Isotopes #37

Open 8me opened 3 years ago

8me commented 3 years ago

I found in the PeriodicTable.jl thread on discourse that there was already the idea to add the individual isotopes to the elements. Has this idea been followed up at some point?

gustavojra commented 3 years ago

I am also interested in have isotope info.

Gregstrq commented 3 years ago

I am interested in isotope info as well. In addition to that, I would like to add nuclear spin and gyromagnetic ratio (depends on the particular isotope).

I understand that adding such information requires careful thinking, but it is precisely the reason the response from maintainers is much needed. So, guys, what are your thoughts about this? Are there any plans to develop this package further or do you just want to leave it like this?

carstenbauer commented 3 years ago

IMO, isotopes and their properties could be added. The main author has also indicated that he is positive about it in the linked discourse thread. As always, the best way to drive things forward is to make a contribution. I'll happily review a PR.

Gregstrq commented 3 years ago

As always, the best way to drive things forward is to make a contribution

No doubt in that. At the same time, I would like to discuss the possible implementations before making a PR.

Presently, Periodic Table contains isotope average data. If we want to add isotopes, it should be separate Elements. Then, isotope-specific information (abundance, spin, gyromagnetic ratio) does not make sense for isotope-averaged data. As a result, a separate Element type is needed to actually store isotope data. Are you ok with that?

On a side note, did you ever consider transforming the PeriodicTable into a DataFrame?

gustavojra commented 3 years ago

Maybe the easier way to keep it organize is to create a Isotope struct like

struct Isotope
    massNumber
    mass
    abundance
    spin
    gyromagneticRatio
    ...
end

then we can add a field to atoms isotopes which can be a vector of Isotope objects or perhaps a named tuple mapping the mass number to the corresponding object. Retrieving info would look like

elements[:C].isotopes[14]

Alternatively we can create a separate structure from elements. In that case retrieving info would also require the atom I guess, since mass number isn't unique (right?)

isotopes[:C, 14]