Skip to content
Open
Show file tree
Hide file tree
Changes from all 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: 2 additions & 2 deletions src/matminer/featurizers/composition/alloy.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,8 @@ def compute_gamma_radii(miracle_radius_stats):
mrmin = miracle_radius_stats["min"]
mrmax = miracle_radius_stats["max"]

numerator = 1 - np.sqrt((mrmean * mrmin + mrmin**2) / (mrmean + mrmin) ** 2)
denominator = 1 - np.sqrt((mrmean * mrmax + mrmax**2) / (mrmean + mrmax) ** 2)
numerator = 1 - np.sqrt(((mrmean + mrmin) ** 2 - mrmean**2) / (mrmean + mrmin) ** 2)
denominator = 1 - np.sqrt(((mrmean + mrmax) ** 2 - mrmean**2) / (mrmean + mrmax) ** 2)
return numerator / denominator

@staticmethod
Expand Down
23 changes: 20 additions & 3 deletions tests/featurizers/composition/test_alloy.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def test_WenAlloys(self):
"Lambda entropy": -12.084431980055149,
"Mean cohesive energy": 4.382084353941212,
"Mixing enthalpy": 3.6650695863166347,
"Radii gamma": 1.4183511064895242,
"Radii gamma": 1.8548430634198114,
"Radii local mismatch": 0.7953797741513383,
"Shear modulus delta": 0.1794147729878139,
"Shear modulus local mismatch": 3.192861083726266,
Expand Down Expand Up @@ -321,7 +321,7 @@ def test_WenAlloys(self):
"Lambda entropy": -12.084431980055149,
"Mean cohesive energy": 4.382084353941212,
"Mixing enthalpy": 3.6650695863166347,
"Radii gamma": 1.4183511064895242,
"Radii gamma": 1.8548430634198114,
"Radii local mismatch": 0.7953797741513383,
"Shear modulus delta": 0.1794147729878139,
"Shear modulus local mismatch": 3.192861083726266,
Expand Down Expand Up @@ -373,7 +373,7 @@ def test_WenAlloys(self):
"Lambda entropy": -0.014796268010071023,
"Mean cohesive energy": 3.0675,
"Mixing enthalpy": 10.652682648401827,
"Radii gamma": 1.9699221262511677,
"Radii gamma": 3.3935618188826431,
"Radii local mismatch": 23.0625,
"Shear modulus delta": 0.37931021448197916,
"Shear modulus local mismatch": 7.13935787671233,
Expand Down Expand Up @@ -402,6 +402,23 @@ def test_WenAlloys(self):
self.assertAlmostEqual(df["Configuration entropy"].iloc[0], -0.008959, places=5)
self.assertAlmostEqual(df["Configuration entropy"].iloc[1], -0.009039, places=5)

def test_wen_alloys_gamma_radii(self):
# Gamma is the ratio of the solid angles of the smallest and largest
# atoms, omega_S / omega_L, with
# omega = 1 - sqrt(((r + r_bar)**2 - r_bar**2) / (r + r_bar)**2),
# per Wang et al., Scripta Mater. 94 (2015) 28-31
# (doi:10.1016/j.scriptamat.2014.09.010).
# https://github.com/hackingmaterials/matminer/issues/952
r_bar, r_min, r_max = 140.0, 120.0, 160.0

def omega(r):
return 1 - np.sqrt(((r_bar + r) ** 2 - r_bar**2) / (r_bar + r) ** 2)

stats = {"mean": r_bar, "min": r_min, "max": r_max}
expected = omega(r_min) / omega(r_max)
self.assertAlmostEqual(WenAlloys.compute_gamma_radii(stats), expected, places=12)
self.assertAlmostEqual(WenAlloys.compute_gamma_radii(stats), 1.3615503496919474, places=12)


if __name__ == "__main__":
unittest.main()