theochem / AtomDB

An Extended Periodic Table of Neutral and Charged Atomic Species
http://atomdb.qcdevs.org/
GNU General Public License v3.0
16 stars 13 forks source link

[Units] Consistent internal units #17

Closed gabrielasd closed 6 months ago

gabrielasd commented 8 months ago

Corresponding values/properties between raw datasets may be stored with different units (e.g. conceptual DFT properties here in eV vs a.u. when computed from HCI/gaussian datasets). We should be consistent and convert them to an internal unit convention as was done in the old repo.

We are using the units module from there when parsing the mass and atomic radii parameters, so the compilation scripts could also import it.

Thes units cript should be updated to use scipy.constants: https://docs.scipy.org/doc/scipy/reference/constants.html

(Likely this is affects mainly the nist dataset)

PaulWAyers commented 8 months ago

I think it would be better to just use scipy constants directly. @FarnazH may disagree with me, as she's a coauthor on theunits module, but the nomenclature there is confusing to me compared to just direct invocation of the appropriate conversion factor from scipy.constants.

gabrielasd commented 6 months ago

The class in the periodic module is replacing the function get_element_data. Therefore, the conversion that get_element_data was doing from the original unit system in elements.csv to our internal units (atomic units) should be supported in periodic as well. The relevant lines in get-element_data are: https://github.com/theochem/AtomDB/blob/968ebf1e48de37af1dd3c20a67263184b66e24a7/atomdb/api.py#L505-L520

An alternative would be to take care of this conversion in the compilation scripts instead, for example as it's done here for the nist dataset: https://github.com/theochem/AtomDB/blob/968ebf1e48de37af1dd3c20a67263184b66e24a7/atomdb/datasets/nist/__init__.py#L133

gabrielasd commented 6 months ago

With the changes introduced by PR #33 and #50 the current code compiles all data in internal units. The definitions of the units can be found in the utility module: https://github.com/theochem/AtomDB/blob/2121615031c8cf14a2a6f2531cda7bb45ce545f6/atomdb/utils.py#L239

I'll close this issue for now, in the future we may want to restore a units module.