Skip to content

Commit

Permalink
More AI doc improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Nov 18, 2024
1 parent f00582a commit 613c50f
Showing 1 changed file with 66 additions and 61 deletions.
127 changes: 66 additions & 61 deletions src/pymatgen/core/periodic_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,71 +61,76 @@
@functools.total_ordering
@unique
class ElementBase(Enum):
"""Element class defined without any enum values so it can be subclassed.
This class is needed to get nested (as|from)_dict to work properly. All emmet classes that had
Element classes required custom construction whereas this definition behaves more like dataclasses
so serialization is less troublesome. There were many times where objects in as_dict serialized
only when they were top level. See https://github.com/materialsproject/pymatgen/issues/2999.
"""
"""Element class defined without any enum values so it can be subclassed."""

def __init__(self, symbol: SpeciesLike) -> None:
"""Basic immutable element object with all relevant properties.
Only one instance of Element for each symbol is stored after creation,
ensuring that a particular element behaves like a singleton. For all
attributes, missing data (i.e., data for which is not available) is
represented by a None unless otherwise stated.
Args:
symbol (str): Element symbol, e.g. "H", "Fe"
"""
This class provides a basic, immutable representation of an element, including
all relevant chemical and physical properties. It ensures that elements are
handled as singletons, reducing redundancy and improving efficiency. Missing
data is represented by `None` unless otherwise specified.
Attributes:
Z (int): Atomic number.
symbol (str): Element symbol.
long_name (str): Long name for element. e.g. "Hydrogen".
A (int) : Atomic mass number (number of protons plus neutrons).
atomic_radius_calculated (float): Calculated atomic radius for the element. This is the empirical value.
Data is obtained from https://wikipedia.org/wiki/Atomic_radii_of_the_elements_(data_page).
van_der_waals_radius (float): Van der Waals radius for the element. This is the empirical value determined
from critical reviews of X-ray diffraction, gas kinetic collision cross-section, and other experimental
data by Bondi and later workers. The uncertainty in these values is on the order of 0.1 Å.
Data are obtained from "Atomic Radii of the Elements" in CRC Handbook of Chemistry and Physics,
91st Ed.; Haynes, W.M., Ed.; CRC Press: Boca Raton, FL, 2010.
mendeleev_no (int): Mendeleev number from definition given by Pettifor, D. G. (1984). A chemical scale
for crystal-structure maps. Solid State Communications, 51 (1), 31-34.
electrical_resistivity (float): Electrical resistivity.
velocity_of_sound (float): Velocity of sound.
reflectivity (float): Reflectivity.
refractive_index (float): Refractive index.
poissons_ratio (float): Poisson's ratio.
molar_volume (float): Molar volume.
electronic_structure (str): Electronic structure. e.g. The electronic structure for Fe is represented
as [Ar].3d6.4s2.
atomic_orbitals (dict): Atomic Orbitals. Energy of the atomic orbitals as a dict. e.g. The orbitals
energies in Hartree are represented as {'1s': -1.0, '2s': -0.1}. Data is obtained from
https://www.nist.gov/pml/data/atomic-reference-data-electronic-structure-calculations.
The LDA values for neutral atoms are used.
atomic_orbitals_eV (dict): Atomic Orbitals. Same as `atomic_orbitals` but energies are in eV.
thermal_conductivity (float): Thermal conductivity.
boiling_point (float): Boiling point.
melting_point (float): Melting point.
critical_temperature (float): Critical temperature.
superconduction_temperature (float): Superconduction temperature.
liquid_range (float): Liquid range.
bulk_modulus (float): Bulk modulus.
youngs_modulus (float): Young's modulus.
brinell_hardness (float): Brinell hardness.
rigidity_modulus (float): Rigidity modulus.
mineral_hardness (float): Mineral hardness.
vickers_hardness (float): Vicker's hardness.
density_of_solid (float): Density of solid phase.
coefficient_of_linear_thermal_expansion (float): Coefficient of linear thermal expansion.
ground_level (float): Ground level for element.
ionization_energies (list[Optional[float]]): List of ionization energies. First value is the first
ionization energy, second is the second ionization energy, etc. Note that this is zero-based indexing!
So Element.ionization_energies[0] refer to the 1st ionization energy. Values are from the NIST Atomic
Spectra Database. Missing values are None.
Z (int): Atomic number of the element.
symbol (str): Element symbol (e.g., "H", "Fe").
long_name (str): Full name of the element (e.g., "Hydrogen").
A (int, optional): Atomic mass number (sum of protons and neutrons).
atomic_radius_calculated (float, optional): Calculated atomic radius (Å).
van_der_waals_radius (float, optional): Van der Waals radius (Å).
mendeleev_no (int, optional): Mendeleev number based on crystal-structure maps.
electrical_resistivity (float, optional): Electrical resistivity (Ω·m).
velocity_of_sound (float, optional): Velocity of sound (m/s).
reflectivity (float, optional): Reflectivity (%).
refractive_index (float, optional): Refractive index.
poissons_ratio (float, optional): Poisson's ratio.
molar_volume (float, optional): Molar volume (cm³/mol).
electronic_structure (str): Electronic structure (e.g., "[Ar].3d6.4s2").
atomic_orbitals (dict): Orbital energies (Hartree units).
atomic_orbitals_eV (dict): Orbital energies in electron volts (eV).
thermal_conductivity (float, optional): Thermal conductivity (W/m·K).
boiling_point (float, optional): Boiling point (K).
melting_point (float, optional): Melting point (K).
critical_temperature (float, optional): Critical temperature (K).
superconduction_temperature (float, optional): Superconducting transition temperature (K).
liquid_range (float, optional): Temperature range for liquid phase (K).
bulk_modulus (float, optional): Bulk modulus (GPa).
youngs_modulus (float, optional): Young's modulus (GPa).
brinell_hardness (float, optional): Brinell hardness (MPa).
rigidity_modulus (float, optional): Rigidity modulus (GPa).
mineral_hardness (float, optional): Mohs hardness.
vickers_hardness (float, optional): Vickers hardness (MPa).
density_of_solid (float, optional): Density in solid phase (g/cm³).
coefficient_of_linear_thermal_expansion (float, optional): Thermal expansion coefficient (K⁻¹).
ground_level (float, optional): Ground energy level of the element.
ionization_energies (list[Optional[float]]): Ionization energies (kJ/mol), indexed from 0.
Examples:
Create an element instance and access its properties:
>>> hydrogen = Element("H")
>>> hydrogen.symbol
'H'
>>> hydrogen.Z
1
>>> hydrogen.electronic_structure
'1s1'
Access additional attributes such as atomic radius:
>>> hydrogen.atomic_radius_calculated
0.53
Notes:
- This class supports handling of isotopes by incorporating named isotopes
and their respective properties.
- Attributes are populated using a JSON file that stores data about all
known elements.
- Some attributes are calculated or derived based on predefined constants
and rules.
References:
- Atomic radius data: https://wikipedia.org/wiki/Atomic_radii_of_the_elements_(data_page)
- Van der Waals radius: CRC Handbook of Chemistry and Physics, 91st Ed.
- Mendeleev number: D. G. Pettifor, "A chemical scale for crystal-structure maps,"
Solid State Communications, 1984.
"""
self.symbol = str(symbol)
data = _pt_data[symbol]
Expand Down

0 comments on commit 613c50f

Please sign in to comment.