Skip to content

Conversation

DanielYang59
Copy link
Contributor

@DanielYang59 DanielYang59 commented Jul 11, 2025

Summary

@DanielYang59 DanielYang59 force-pushed the element-property-unit branch from 1190a26 to 97bd8b2 Compare July 11, 2025 08:10
@DanielYang59 DanielYang59 changed the title Remove unit in docstring for Element properties Fix unit for Element properties: density_of_solid and Molar volume Jul 11, 2025
Np: 4273, Pu: 3503, Am: 2880, Cm: 3383}
Brinell hardness:
unit: MN m^-2
unit: MPa
Copy link
Contributor Author

@DanielYang59 DanielYang59 Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be breaking.

These two units are exactly the same but feels like MPa might be more common than MN m^-2 (also more consistent with docstring and other hardness)?

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).

mineral_hardness (float, optional): Mohs hardness.
vickers_hardness (float, optional): Vickers hardness (MPa).
density_of_solid (float, optional): Density in solid phase (g/cm³).
density_of_solid (float, optional): Density in solid phase (kg/m³).
Copy link
Contributor Author

@DanielYang59 DanielYang59 Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no strong opinion on this, I originally thought we just remove all units from the docstring if it's a scalar and redirect people to get the unit from FloatWithUnit, but feels like it's not good for docstring clarity as most data for ptable wouldn't be updated very often, also many units are pretty much "singleton" (e.g. K for temperature, angstrom for radii,...):

Attributes:
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.

@DanielYang59 DanielYang59 marked this pull request as ready for review July 11, 2025 13:52
@shyuep shyuep merged commit 2f2c8d7 into materialsproject:master Jul 29, 2025
44 checks passed
@DanielYang59 DanielYang59 deleted the element-property-unit branch July 29, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Units in docstring appear to be wrong for density_in_solid
2 participants