From 3830956dcc4825856f5f2d8cdb8410eaa5a8cbb9 Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Thu, 9 May 2024 19:53:34 +0800 Subject: [PATCH 1/8] make Sc and Y rare earth ele --- pymatgen/core/periodic_table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymatgen/core/periodic_table.py b/pymatgen/core/periodic_table.py index 9aa48fe34b2..bd5079a5c89 100644 --- a/pymatgen/core/periodic_table.py +++ b/pymatgen/core/periodic_table.py @@ -689,7 +689,7 @@ def is_post_transition_metal(self) -> bool: @property def is_rare_earth_metal(self) -> bool: """True if element is a rare earth metal.""" - return self.is_lanthanoid or self.is_actinoid + return self.is_lanthanoid or self.is_actinoid or self.symbol in {"Sc", "Y"} @property def is_metal(self) -> bool: From 65a9ffd514e1108fedfb2bce7a09764ed4d07d7e Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Thu, 9 May 2024 19:59:39 +0800 Subject: [PATCH 2/8] update docstring --- pymatgen/core/periodic_table.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pymatgen/core/periodic_table.py b/pymatgen/core/periodic_table.py index bd5079a5c89..d946660076c 100644 --- a/pymatgen/core/periodic_table.py +++ b/pymatgen/core/periodic_table.py @@ -688,7 +688,11 @@ def is_post_transition_metal(self) -> bool: @property def is_rare_earth_metal(self) -> bool: - """True if element is a rare earth metal.""" + """True if element is a rare earth metal, including Scandium (Sc), + Yttrium (Y), Lanthanides (La) series and Actinides (Ac) series. + + Reference: https://en.wikipedia.org/wiki/Rare-earth_element. + """ return self.is_lanthanoid or self.is_actinoid or self.symbol in {"Sc", "Y"} @property From f7bdcd0cc234d8563551defae6fb786b98caee02 Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Sun, 12 May 2024 19:30:49 +0800 Subject: [PATCH 3/8] log breaking change --- docs/compatibility.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/compatibility.md b/docs/compatibility.md index 705cb1e8a06..1634c2c2236 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -3,7 +3,6 @@ layout: default title: Compatibility nav_order: 3 --- - # Compatibility Pymatgen is a tool used for academic research and is actively developed by @@ -67,6 +66,10 @@ Windows and Linux. ## Recent Breaking Changes +## v2024.xx.xx + +Scandium (Sc) and Yttrium (Y) would be included into `is_rare_earth_metal` property for `Element` in [#3817](https://github.com/materialsproject/pymatgen/pull/3817). + ## v2024.1.26 The mixture of `(get|from)_str` and `(get|from)_string` methods on various `pymatgen` classes were migrated to a consistent `(get|from)_str` everywhere in [#3158](https://github.com/materialsproject/pymatgen/pull/3158) and several follow-up PRs. The deprecation release was [v2023.8.10](https://github.com/materialsproject/pymatgen/releases/tag/v2023.8.10) and the removal release resulting in a breaking change was [v2024.1.26](https://github.com/materialsproject/pymatgen/releases/tag/v2024.1.26). Migration to the new API in all cases is to replace: From b9558652605bcb7ace5f93a998c7242f958e4208 Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Sun, 12 May 2024 19:31:48 +0800 Subject: [PATCH 4/8] revert removal of blank line --- docs/compatibility.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/compatibility.md b/docs/compatibility.md index 1634c2c2236..197eaa978bc 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -3,6 +3,7 @@ layout: default title: Compatibility nav_order: 3 --- + # Compatibility Pymatgen is a tool used for academic research and is actively developed by From faf0a41fa670b625ed0138bc29cf6d593a0c5b7c Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Wed, 15 May 2024 16:17:51 +0800 Subject: [PATCH 5/8] update grace period --- docs/compatibility.md | 2 +- pymatgen/core/periodic_table.py | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/compatibility.md b/docs/compatibility.md index 197eaa978bc..49cbc673b73 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -69,7 +69,7 @@ Windows and Linux. ## v2024.xx.xx -Scandium (Sc) and Yttrium (Y) would be included into `is_rare_earth_metal` property for `Element` in [#3817](https://github.com/materialsproject/pymatgen/pull/3817). +Scandium (Sc) and Yttrium (Y) would be included into `is_rare_earth_metal` property for `Element` after 2025-05-15, in [#3817](https://github.com/materialsproject/pymatgen/pull/3817). ## v2024.1.26 diff --git a/pymatgen/core/periodic_table.py b/pymatgen/core/periodic_table.py index 0fe0004a10e..b4b1667b28a 100644 --- a/pymatgen/core/periodic_table.py +++ b/pymatgen/core/periodic_table.py @@ -697,12 +697,19 @@ def is_post_transition_metal(self) -> bool: @property def is_rare_earth_metal(self) -> bool: - """True if element is a rare earth metal, including Scandium (Sc), - Yttrium (Y), Lanthanides (La) series and Actinides (Ac) series. + """True if element is a rare earth metal, Lanthanides (La) series and Actinides (Ac) series. + + WARNING: This property would be updated to include Scandium (Sc) and + Yttrium (Y) after 2025-05-15. Reference: https://en.wikipedia.org/wiki/Rare-earth_element. """ - return self.is_lanthanoid or self.is_actinoid or self.symbol in {"Sc", "Y"} + warnings.warn( + "Y and Sc would be considered rare earth metal after 2025-05-15.", + stacklevel=2, + ) + + return self.is_lanthanoid or self.is_actinoid # or self.symbol in {"Sc", "Y"} @property def is_metal(self) -> bool: From 1a65b7d81a6500e6803309af6750e0f4279e759c Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Sat, 18 May 2024 10:43:07 +0800 Subject: [PATCH 6/8] add is_rare_earth and deprecate the old --- docs/compatibility.md | 4 ---- pymatgen/core/periodic_table.py | 19 ++++++++++--------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/docs/compatibility.md b/docs/compatibility.md index 49cbc673b73..705cb1e8a06 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -67,10 +67,6 @@ Windows and Linux. ## Recent Breaking Changes -## v2024.xx.xx - -Scandium (Sc) and Yttrium (Y) would be included into `is_rare_earth_metal` property for `Element` after 2025-05-15, in [#3817](https://github.com/materialsproject/pymatgen/pull/3817). - ## v2024.1.26 The mixture of `(get|from)_str` and `(get|from)_string` methods on various `pymatgen` classes were migrated to a consistent `(get|from)_str` everywhere in [#3158](https://github.com/materialsproject/pymatgen/pull/3158) and several follow-up PRs. The deprecation release was [v2023.8.10](https://github.com/materialsproject/pymatgen/releases/tag/v2023.8.10) and the removal release resulting in a breaking change was [v2024.1.26](https://github.com/materialsproject/pymatgen/releases/tag/v2024.1.26). Migration to the new API in all cases is to replace: diff --git a/pymatgen/core/periodic_table.py b/pymatgen/core/periodic_table.py index b4b1667b28a..f46bcd82049 100644 --- a/pymatgen/core/periodic_table.py +++ b/pymatgen/core/periodic_table.py @@ -14,6 +14,7 @@ from typing import TYPE_CHECKING import numpy as np +from monty.dev import deprecated from monty.json import MSONable from pymatgen.core.units import SUPPORTED_UNIT_NAMES, FloatWithUnit, Ha_to_eV, Length, Mass, Unit @@ -696,20 +697,20 @@ def is_post_transition_metal(self) -> bool: return self.symbol in ("Al", "Ga", "In", "Tl", "Sn", "Pb", "Bi") @property + @deprecated(message="Please use is_rare_earth instead, which is corrected to include Y and Sc.") def is_rare_earth_metal(self) -> bool: """True if element is a rare earth metal, Lanthanides (La) series and Actinides (Ac) series. - WARNING: This property would be updated to include Scandium (Sc) and - Yttrium (Y) after 2025-05-15. - - Reference: https://en.wikipedia.org/wiki/Rare-earth_element. + This property is Deprecated, and scheduled for removal after 2025-01-01. """ - warnings.warn( - "Y and Sc would be considered rare earth metal after 2025-05-15.", - stacklevel=2, - ) + return self.is_lanthanoid or self.is_actinoid - return self.is_lanthanoid or self.is_actinoid # or self.symbol in {"Sc", "Y"} + @property + def is_rare_earth(self) -> bool: + """True if element is a rare earth element, including Lanthanides (La) + series, Actinides (Ac) series, Scandium (Sc) and Yttrium (Y). + """ + return self.is_lanthanoid or self.is_actinoid or self.symbol in {"Sc", "Y"} @property def is_metal(self) -> bool: From 1eefdbe29de309991bec52cc7d3b6e8140567faa Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Sat, 18 May 2024 10:48:36 +0800 Subject: [PATCH 7/8] update `monty` to use `deadline` --- pymatgen/core/periodic_table.py | 4 +++- requirements.txt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pymatgen/core/periodic_table.py b/pymatgen/core/periodic_table.py index f46bcd82049..054a0005c3c 100644 --- a/pymatgen/core/periodic_table.py +++ b/pymatgen/core/periodic_table.py @@ -697,7 +697,9 @@ def is_post_transition_metal(self) -> bool: return self.symbol in ("Al", "Ga", "In", "Tl", "Sn", "Pb", "Bi") @property - @deprecated(message="Please use is_rare_earth instead, which is corrected to include Y and Sc.") + @deprecated( + message="Please use is_rare_earth instead, which is corrected to include Y and Sc.", deadline=(2025, 1, 1) + ) def is_rare_earth_metal(self) -> bool: """True if element is a rare earth metal, Lanthanides (La) series and Actinides (Ac) series. diff --git a/requirements.txt b/requirements.txt index 384479945c4..064010dfd58 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ numpy==1.26.0 sympy==1.12 requests==2.31.0 -monty==2024.2.26 +monty>=2024.5.15 ruamel.yaml==0.18.6 scipy==1.11.3 tabulate==0.9.0 From 83ba373c6728f6392bec636cf5f7b621f49f0020 Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Sat, 25 May 2024 16:02:39 +0800 Subject: [PATCH 8/8] update monty to latest --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 064010dfd58..6f58f99eda1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ numpy==1.26.0 sympy==1.12 requests==2.31.0 -monty>=2024.5.15 +monty>=2024.5.24 ruamel.yaml==0.18.6 scipy==1.11.3 tabulate==0.9.0