Skip to main content

Physical constants, conversion factors, and a periodic table with clear source information for every value.

Project description

QCConst

image image image Actions status Actions status

Physical constants, conversion factors, and a periodic table with clear source information for every value. Data from NIST CODATA 2022, Pubchem, and Washington University. All data in atomic units (e.g., length in Bohr).

Data Sources

Each piece of data contains a link to its source. Primary data sources include:

Data Name Source Source Links
Physical Constants NIST 2022 CODATA Individual Constant Lookup, Fundamenal Constants Listing, Conversion Factors
Periodic Table PubChem, Cordero 2008, Pyykkö 2009, Alvarez 2013 Periodic Table, Raw CSV Data, Cordero 2008, Pyykkö 2009, Alvarez 2013
Solvent Data University of Washington Solvent Properties

Installation

python -m pip install qcconst

Quickstart

Constants

Top-level constants can be accessed at attributes on the constants module for easy discovery and TAB-completion in Jupyter Notebooks or IDEs. This is the most convenient way to access constants. Most values come directly from CODATA (or are conversion factors computed directly from CODATA) that are given more computationally-friendly names for easy access.

>>> from qcconst import constants

>>> constants.BOHR_TO_ANGSTROM
0.529177210544, unit=Å, source=https://physics.nist.gov/cgi-bin/cuu/Value?bohrrada0

# Use constants just like a float
>>> constants.BOHR_TO_ANGSTROM * 10
5.29177210544

# Know the source of every constant
>>> constants.BOHR_TO_ANGSTROM.source
'https://physics.nist.gov/cgi-bin/cuu/Value?bohrrada0'

# See sources for all constants
>>> constants.sources
['https://physics.nist.gov/cgi-bin/cuu/Value?bohrrada0', 'https://physics.nist.gov/cgi-bin/cuu/Value?hrj|search_for=hartree+to+joule', 'https://physics.nist.gov/cuu/Constants/Table/allascii.txt', 'https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors/nist-guide-si-appendix-b8']

# List all available constants
>>> constants.as_list()
['ANGSTROM_TO_BOHR', 'AVOGADRO_NUMBER', 'BOHR_TO_ANGSTROM', 'BOLTZMANN_CONSTANT', 'HARTREE_TO_JOULE', 'HARTREE_TO_KCAL_PER_MOL', 'KCAL_TO_JOULE', ...]

# Human readable print out of all available constants
>>> constants.show()
name                              value  unit      source
-----------------------  --------------  --------  ---------------------------------------------------------
ANGSTROM_TO_BOHR            1.88973      Bohr      Derived as 1 / BOHR_TO_ANGSTROM
AVOGADRO_NUMBER             6.02214e+23  mol⁻¹     https://physics.nist.gov/cuu/Constants/Table/allascii.txt
BOHR_TO_ANGSTROM            0.529177     Å         https://physics.nist.gov/cgi-bin/cuu/Value?bohrrada0
BOLTZMANN_CONSTANT          1.38065e-23  J/K       https://physics.nist.gov/cuu/Constants/Table/allascii.txt
...

All CODATA Physical Constants

The full CODATA 2022 set of constants are available by their NIST-given name at constants.phys or constants.codata2022. constants.phys will always point to the latest CODATA values. Currently this is the 2022 release.

>>> from qcconst import constants

>>> constants.phys['atomic unit of permittivity']
1.1126500562e-10, unit=kg m s^-1, source=CODATA 2022: https://physics.nist.gov/cuu/Constants/Table/allascii.txt

>>> constants.codata2022['conventional value of von Klitzing constant']
25812.807, unit=ohm, source=CODATA 2022: https://physics.nist.gov/cuu/Constants/Table/allascii.txt

Periodic Table

>>> from qcconst import periodic_table as pt

>>> pt.Ni
Element(symbol='Ni', number=28, name='Nickel', mass=58.6934, group=10, period=4, block='d', electron_config='[Ar] 3d8 4s2')

>>>pt.Ni.number
28

# Lookup by atomic number
>>> pt.number(4)
Element(symbol='Be', number=4, name='Beryllium', mass=9.012183, group=2, period=2, block='Alkaline earth metal', electron_config='[He]2s2')

>>> pt.group(1)
[Element(symbol='H', number=1, name='Hydrogen', mass=1.00784, group=1, period=1, block='s', electron_config='1s1'),
Element(symbol='Li', number=3, name='Lithium', mass=6.94, group=1, period=2, block='s', electron_config='[He] 2s1'),
Element(symbol='Na', number=11, name='Sodium', mass=22.98976928, group=1, period=3, block='s', electron_config='[Ne] 3s1'),
Element(symbol='K', number=19, name='Potassium', mass=39.0983, group=1, period=4, block='s', electron_config='[Ar] 4s1'),
Element(symbol='Rb', number=37, name='Rubidium', mass=85.4678, group=1, period=5, block='s', electron_config='[Kr] 5s1'),
Element(symbol='Cs', number=55, name='Cesium', mass=132.90545196, group=1, period=6, block='s', electron_config='[Xe] 6s1'),
Element(symbol='Fr', number=87, name='Francium', mass=223.0, group=1, period=7, block='s', electron_config='[Rn] 7s1')]

>>> pt.period(3)
[Element(symbol='Na', number=11, name='Sodium', mass=22.9897693, group=1, period=3, block='Alkali metal', electron_config='[Ne]3s1'),
Element(symbol='Mg', number=12, name='Magnesium', mass=24.305, group=2, period=3, block='Alkaline earth metal', electron_config='[Ne]3s2'),
Element(symbol='Al', number=13, name='Aluminum', mass=26.981538, group=13, period=3, block='Post-transition metal', electron_config='[Ne]3s2 3p1'),
Element(symbol='Si', number=14, name='Silicon', mass=28.085, group=14, period=3, block='Metalloid', electron_config='[Ne]3s2 3p2'),
Element(symbol='P', number=15, name='Phosphorus', mass=30.973762, group=15, period=3, block='Nonmetal', electron_config='[Ne]3s2 3p3'),
Element(symbol='S', number=16, name='Sulfur', mass=32.07, group=16, period=3, block='Nonmetal', electron_config='[Ne]3s2 3p4'),
Element(symbol='Cl', number=17, name='Chlorine', mass=35.45, group=17, period=3, block='Halogen', electron_config='[Ne]3s2 3p5'),
Element(symbol='Ar', number=18, name='Argon', mass=39.9, group=18, period=3, block='Noble gas', electron_config='[Ne]3s2 3p6')]

# Know the sources of the data
>>> pt.sources
['Alvarez 2013: https://doi.org/10.1039/C3DT50599E', 'Pyykkö et al. 2009: https://doi.org/10.1002/chem.200901472', 'PubChem: https://pubchem.ncbi.nlm.nih.gov/periodic-table', 'Cordero et al. 2008: https://doi.org/10.1039/b801115j']

# Human readable print out of the Periodic Table data
>>> pt.show()
Sources: ['Pyykkö et al. 2009: https://doi.org/10.1002/chem.200901472', 'Cordero et al. 2008: https://doi.org/10.1039/b801115j', 'Alvarez 2013: https://doi.org/10.1039/C3DT50599E', 'PubChem: https://pubchem.ncbi.nlm.nih.gov/periodic-table']

symbol  number  name           mass    group  period  block                  electron_config                    electronegativity  atomic_radius  cov_radius  cov_radius_double  cov_radius_triple  vdw_radius
------  ------  -------------  ------  -----  ------  ---------------------  ---------------------------------  -----------------  -------------  ----------  -----------------  -----------------  ----------
H            1  Hydrogen        1.008      1       1  Nonmetal               1s1                                              2.2         2.2677     0.58582                                            2.2677
He           2  Helium         4.0026     18       1  Noble gas              1s2                                                          2.6456     0.52912                                            2.7023
Li           3  Lithium             7      1       2  Alkali metal           [He]2s1                                         0.98         3.4393      2.4188             2.3433                         4.0062
Be           4  Beryllium      9.0122      2       2  Alkaline earth metal   [He]2s2                                         1.57         2.8913      1.8141             1.7008             1.6063      3.7417
B            5  Boron           10.81     13       2  Metalloid              [He]2s2 2p1                                     2.04         3.6283      1.5874              1.474             1.3795      3.6094
C            6  Carbon         12.011     14       2  Nonmetal               [He]2s2 2p2                                     2.55         3.2125      1.4362             1.2661             1.1338      3.3448
N            7  Nitrogen       14.007     15       2  Nonmetal               [He] 2s2 2p3                                    3.04         2.9291      1.3417             1.1338             1.0205      3.1369
...

Solvents

Solvents are accessed with a dictionary lookup rather than attribute lookup because many of their names are invalid Python attributes (i.e., they start with a number or contain - characters). For example, solvents.1,2-dimethoxyethane is invalid syntax. As a result, solvents are looked up using solvents['name'] rather than solvents.name.

from qcconst import solvents

>>> solvents["1,4-dioxane"]
Solvent(name='1,4-dioxane', dielectric=2.25, sources=['https://depts.washington.edu/eooptic/linkfiles/dielectric_chart%5B1%5D.pdf'])

>>> solvents["1,4-dioxane"].dielectric
2.25

# Will return None if solvent not found
>>> solvents.get("Fake Solvent")
>>>

# List all available solvents
>>> solvents.as_list()
['acetic acid', 'acetone', 'acetonitrile', 'anisole', 'benzene', 'bromobenzene', 'carbon disulfide', 'carbon tetrachloride', 'chlorobenzene', 'chloroform', 'cyclohexane', 'dibutyl ether', 'o-dichlorobenzene', '1,2-dichloroethane', 'dichloromethane', 'diethylamine', 'diethyl ether', '1,2-dimethoxyethane', 'n', 'n,n-dimethylformamide', 'dimethyl sulfoxide', '1,4-dioxane', 'ethanol', 'ethyl acetate', 'ethyl benzoate', 'formamide', 'hexamethylphosphoramide', 'isopropyl alcohol', 'methanol', '2-methyl-2-propanol', 'nitrobenzene', 'nitromethane', 'pyridine', 'tetrahydrofuran', 'toluene', 'trichloroethylene', 'triethylamine', 'trifluoroacetic acid', '2,2,2-trifluoroethanol', 'water', 'o-xylene', ...]

# Know the sources of the data
>>> solvents["water"].sources
['https://depts.washington.edu/eooptic/linkfiles/dielectric_chart%5B1%5D.pdf']

# Human readable print out of all available solvents
>>> solvents.show()
name                       dielectric  sources
-----------------------  ------------  ------------------------------------------------------------------------------
acetic acid                      6.15  ['https://depts.washington.edu/eooptic/linkfiles/dielectric_chart%5B1%5D.pdf']
acetone                         20.7   ['https://depts.washington.edu/eooptic/linkfiles/dielectric_chart%5B1%5D.pdf']
acetonitrile                    37.5   ['https://depts.washington.edu/eooptic/linkfiles/dielectric_chart%5B1%5D.pdf']
anisole                          4.33  ['https://depts.washington.edu/eooptic/linkfiles/dielectric_chart%5B1%5D.pdf']
benzene                          2.27  ['https://depts.washington.edu/eooptic/linkfiles/dielectric_chart%5B1%5D.pdf']
bromobenzene                     5.17  ['https://depts.washington.edu/eooptic/linkfiles/dielectric_chart%5B1%5D.pdf']
...

Adding New Values

Adding new values is simple! Just add it to one of the .csv files in src/qcconst/data. Include the value, its source, and any other required metadata and then open a PR. That's it! ✨

The QC Suite of Programs

If you like qcconst you may like my other libraries for computational chemistry.

  • qcio - Elegant and intuitive data structures for quantum chemistry, featuring seamless Jupyter Notebook visualizations. Documentation
  • qccodec - A library for parsing Quantum Chemistry output files into structured data objects and converting structured input objects into program-native input files. Uses data structures from qcio.
  • qcop - A package for operating quantum chemistry programs using qcio standardized data structures. Compatible with TeraChem, psi4, QChem, NWChem, ORCA, Molpro, geomeTRIC and many more.
  • BigChem - A distributed application for running quantum chemistry calculations at scale across clusters of computers or the cloud. Bring multi-node scaling to your favorite quantum chemistry program.
  • ChemCloud - A web application and associated Python client for exposing a BigChem cluster securely over the internet.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qcconst-0.2.0.tar.gz (54.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qcconst-0.2.0-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file qcconst-0.2.0.tar.gz.

File metadata

  • Download URL: qcconst-0.2.0.tar.gz
  • Upload date:
  • Size: 54.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for qcconst-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b7e67e25640196a7d2c624e5a6cd9f4864a43823b8a9298fac19ee826e4a39a8
MD5 c4c3b91be409fd6ef77b77d2be6dc49a
BLAKE2b-256 96375c66e7ce5a59065e32cb304af56715d1e13668ef8dd071492d636b87ab25

See more details on using hashes here.

Provenance

The following attestation bundles were made for qcconst-0.2.0.tar.gz:

Publisher: publish-to-pypi.yaml on coltonbh/qcconst

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qcconst-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: qcconst-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 33.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for qcconst-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bbd50f4d791581c28efc123675335acfb4eb0a3fb114fd4d43ac741f75e3a372
MD5 4ec3cd86104abeb6356538d21d6c3cb6
BLAKE2b-256 9f1ba3d4c0af70855e9178433775eebfdc1b6fa24d2797b70ec2f1d659a5261d

See more details on using hashes here.

Provenance

The following attestation bundles were made for qcconst-0.2.0-py3-none-any.whl:

Publisher: publish-to-pypi.yaml on coltonbh/qcconst

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page