The `periodictable` library for Python (current version 2.1.0) provides an extensible periodic table of elements, pre-populated with data crucial for neutron and X-ray scattering experiments. It offers access to element properties such as mass, density, and scattering information. The library is actively maintained with regular updates to data sources and improvements. Its release cadence is driven by updates to fundamental physical constants and scattering data.
pip install periodictableVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import the `periodictable` library, access individual elements by symbol or name, retrieve common properties like mass and density, iterate through the entire collection of elements, create and query chemical formulas, and access specific isotopes along with their properties like neutron scattering length.
Update references from `periodictable.constants.plancks_constant` to `periodictable.constants.planck_constant`. Adjust any calculations expecting eV·s units to use J/Hz (or J·s) as appropriate.
If you relied on `Z=0` for neutron properties, explicitly manage neutron objects or adapt your iteration logic to exclude Z=0. Neutron-specific functionalities should be accessed through appropriate methods or by constructing a neutron object if needed, rather than assuming it's part of the standard element iteration.
Update code that unpacks the return values from `neutron_sld` to expect `(real_coherent, imaginary_coherent, incoherent)` instead of `(coherent, absorption, incoherent)`.
Replace `periodictable.formula(value='H2O')` with `periodictable.formula(compound='H2O')`.
Always refer to the library's official documentation or data sources section to understand the origin of the values if high precision or comparison with other software/literature is critical. Be aware that minor discrepancies are expected.
Ensure the package is installed using `pip install periodictable`. If using virtual environments, activate the correct environment before installation and running your script.
Refer to the `periodictable.constants` module documentation. For Planck's constant, use `periodictable.constants.planck_constant`.
Avoid using atomic number 0 for the bare neutron after version 2.0.0. Ensure the atomic number used is valid and corresponds to an existing element in the periodic table (1-118).