qdk_chemistry.constants module

QDK/Chemistry Physical Constants Module.

This module provides access to physical constants from CODATA standards [MNT25]. The constants are sourced from the most recent CODATA recommendations (currently CODATA 2022), but the underlying C++ implementation supports multiple CODATA versions for compatibility and comparison purposes.

All constants are provided in their original units as specified by CODATA, with conversion factors available for different unit systems.

The constants include fundamental physical constants, particle masses, and energy conversion factors commonly used in computational chemistry and quantum mechanics.

Data Source:

CODATA recommended values of the fundamental physical constants Currently using: CODATA 2022 (default) Also available: CODATA 2018, CODATA 2014 (via C++ preprocessor directives) https://physics.nist.gov/cuu/Constants/

Constants Documentation:

Each constant includes detailed documentation about its physical meaning, units, mathematical symbol, and provenance. The documentation automatically reflects the CODATA version currently in use. You can access this information using the get_constant_info() function or by examining the __doc__ attribute of individual constants.

Examples

>>> from qdk_chemistry.constants import ANGSTROM_TO_BOHR, HARTREE_TO_EV
>>> length_angstrom = 1.5
>>> length_bohr = length_angstrom * ANGSTROM_TO_BOHR
>>> # Access detailed documentation (reflects current CODATA version)
>>> from qdk_chemistry.constants import get_constant_info
>>> info = get_constant_info('bohr_to_angstrom')
>>> print(f"{info.description} ({info.symbol}): {info.value} {info.units}")
>>> print(f"Source: {info.source}")
>>> # Or use the docstring
>>> help(angstrom_to_bohr)
>>> # List all available constants with their documentation
>>> from qdk_chemistry.constants import list_constants
>>> list_constants()
class qdk_chemistry.constants.ConstantInfo

Bases: pybind11_object

Documentation information for a physical constant

__init__(*args, **kwargs)
property description

Description of the physical meaning

property name

Name of the constant

property source

Data source (e.g., ‘CODATA 2022’)

property symbol

Mathematical symbol

property units

Units of measurement

property value

Numerical value

qdk_chemistry.constants.find_constant(search_term)[source]

Find constants matching a search term.

Return type:

dict

Parameters:

search_term (str) – Term to search for in constant names or descriptions

Returns:

Dictionary of matching constants and their info

Examples

>>> find_constant("bohr")
>>> find_constant("mass")
>>> find_constant("energy")
qdk_chemistry.constants.get_constant_info(name: str) qdk_chemistry.constants.ConstantInfo

Get documentation information for a specific constant

qdk_chemistry.constants.get_constants_info() dict[str, qdk_chemistry.constants.ConstantInfo]

Get documentation information for all available constants

qdk_chemistry.constants.get_current_codata_version() str

Get the current CODATA version being used (e.g., ‘CODATA 2022’)

qdk_chemistry.constants.list_constants(show_values=True, show_units=True)[source]

List all available constants with their documentation.

Return type:

None

Parameters:
  • show_values (bool) – Whether to display the numerical values, default True

  • show_units (bool) – Whether to display the units, default True

Examples

>>> list_constants()
>>> list_constants(show_values=False)  # Just names and descriptions
qdk_chemistry.constants.show_constant_details(name)[source]

Print detailed information about a specific constant.

Return type:

None

Parameters:

name (str) – Name of the constant

Examples

>>> show_constant_details('bohr_to_angstrom')
>>> show_constant_details('fine_structure_constant')