Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/pymatgen/analysis/elasticity/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ class ElasticTensor(NthOrderElasticTensor):
in units of eV/A^3.
"""

eV_A3_to_GPa = Unit("eV ang^-3").get_conversion_factor(Unit("GPa"))

def __new__(cls, input_array, tol: float = 1e-4) -> Self:
"""
Create an ElasticTensor object. The constructor throws an error if the shape of
Expand Down Expand Up @@ -201,7 +203,7 @@ def y_mod(self) -> float:
Calculates Young's modulus (in SI units) using the
Voigt-Reuss-Hill averages of bulk and shear moduli.
"""
return 9.0e9 * self.k_vrh * self.g_vrh / (3 * self.k_vrh + self.g_vrh)
return 9.0e9 * self.k_vrh * self.g_vrh * self.eV_A3_to_GPa / (3 * self.k_vrh + self.g_vrh)
Copy link
Contributor

@esoteric-ephemera esoteric-ephemera Nov 7, 2025

Choose a reason for hiding this comment

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

@anyangml I would change the docstr to:

Calculates Young's modulus using Voigt-Reuss-Hill averages of bulk and shear moduli.

and remove the conversion to GPa here (and elsewhere where SI units are reported):

return 9* self.k_vrh * self.g_vrh / (3 * self.k_vrh + self.g_vrh)


def directional_poisson_ratio(self, n: ArrayLike, m: ArrayLike, tol: float = 1e-8) -> float:
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/analysis/elasticity/test_elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_properties(self):
# voigt notation tensor
assert_allclose(self.elastic_tensor_1.voigt, self.voigt_1)
# young's modulus
assert self.elastic_tensor_1.y_mod == approx(54087787667.160583)
assert self.elastic_tensor_1.y_mod == approx(8665818958507.804)

# prop dict
prop_dict = self.elastic_tensor_1.property_dict
Expand Down Expand Up @@ -127,7 +127,7 @@ def test_structure_based_methods(self):
assert self.elastic_tensor_1.snyder_opt(struct) == approx(0.18937465)
assert self.elastic_tensor_1.snyder_total(struct) == approx(18.25064540)
# Clarke
assert self.elastic_tensor_1.clarke_thermalcond(struct) == approx(0.3450307)
assert self.elastic_tensor_1.clarke_thermalcond(struct) == approx(4.367299105244635)
# Cahill
cahill_thermal_cond = self.elastic_tensor_1.cahill_thermalcond(struct)
assert cahill_thermal_cond == approx(0.37896275)
Expand Down