MolSSI / QCElemental

Periodic table, physical constants, and molecule parsing for quantum chemistry.
https://molssi.github.io/QCElemental/
BSD 3-Clause "New" or "Revised" License
143 stars 70 forks source link

Element 118 is missing from the data tables #245

Open kjelljorner opened 4 years ago

kjelljorner commented 4 years ago

Element 118 (Oganesson) is absent from the periodic table (and probably other places as well). I would guess this is due to presence of the dummy atom with atomic number 0.

>>> import qcelemental as qcel
>>> print(qcel.__file__, qcel.__version__)
C:\Users\kjell\Miniconda3\envs\morfeus\lib\site-packages\qcelemental\__init__.py v0.17.0
>>> print(qcel.periodictable.to_name(117))
Tennessine
>>> print(qcel.periodictable.to_name(118))
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\Miniconda3\envs\morfeus\lib\site-packages\qcelemental\periodic_table.py in resolve_eliso(atom)
     75             try:
---> 76                 self._eliso2mass[atom.capitalize()]  # type: ignore
     77             except (KeyError, AttributeError):

AttributeError: 'int' object has no attribute 'capitalize'

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
~\Miniconda3\envs\morfeus\lib\site-packages\qcelemental\periodic_table.py in resolve_eliso(atom)
     78                 try:
---> 79                     E = self._z2el[int(atom)]
     80                 except (KeyError, ValueError):

KeyError: 118

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
~\Miniconda3\envs\morfeus\lib\site-packages\qcelemental\periodic_table.py in resolve_eliso(atom)
     81                     try:
---> 82                         E = self._element2el[atom.capitalize()]  # type: ignore
     83                     except (KeyError, AttributeError):

AttributeError: 'int' object has no attribute 'capitalize'

During handling of the above exception, another exception occurred:

NotAnElementError                         Traceback (most recent call last)
<ipython-input-123-bbc5c2380cd0> in <module>
      2 print(qcel.__file__, qcel.__version__)
      3 print(qcel.periodictable.to_name(117))
----> 4 print(qcel.periodictable.to_name(118))

~\Miniconda3\envs\morfeus\lib\site-packages\qcelemental\periodic_table.py in to_element(self, atom, strict)
    235 
    236         """
--> 237         identifier = self._resolve_atom_to_key(atom, strict=strict)
    238         return self._el2element[self._eliso2el[identifier]]
    239 

~\Miniconda3\envs\morfeus\lib\site-packages\qcelemental\periodic_table.py in _resolve_atom_to_key(self, atom, strict)
     91                 return atom.capitalize()
     92 
---> 93         eliso = resolve_eliso(atom)
     94 
     95         if strict and eliso not in self.E:

~\Miniconda3\envs\morfeus\lib\site-packages\qcelemental\periodic_table.py in resolve_eliso(atom)
     82                         E = self._element2el[atom.capitalize()]  # type: ignore
     83                     except (KeyError, AttributeError):
---> 84                         raise NotAnElementError(atom)
     85                     else:
     86                         return E

NotAnElementError: 118
loriab commented 4 years ago

Yes, 118 is missing because we used the periodic table NIST had provided in JSON (and 118 was unlikely to come up in quantum chemistry). Then they discontinued publishing in structured format (see raw_data/nist_data/README). Judging from the coarse changelog, the data is from before Version 9. I see now that there's an ascii format https://physics.nist.gov/cgi-bin/Compositions/stand_alone.pl?ele=&all=all&ascii=ascii2&isotype=all . It'd be good to switch harvesting to that. Thanks for the reminder.

kjelljorner commented 4 years ago

I tested harvesting the ASCII file and it is OK if not very convenient. The ASE actually has a convenience function that might be useful that points to some type of "hidden" perl script: https://wiki.fysik.dtu.dk/ase/_modules/ase/data/isotopes.html#download_isotope_data

I noticed that there is some arbitrariness when it comes to the most common isotope for elements that don't occur naturally (radioactive isotopes). Convention seems to be to take the most stable isotope in terms of half-life, but this rule is also violated in some codes for different purposes (for example mendeleev). I think the old version of the NIST data that you got from the JSON had "erroneous" selections for some of the most stable isotopes judging from their changelog. Current NIST data seems to instead omit the preferred isotope for these elements.

Here is a nice compilation of the most stable isotopes https://www.qmul.ac.uk/sbcs/iupac/AtWt/

Reference data on the most stable isotopes can be found here but I haven't found any machine readable files. https://www.ciaaw.org/radioactive-elements.htm