Skip to content

Commit

Permalink
[Deprecation] Replace Element property is_rare_earth_metal with `…
Browse files Browse the repository at this point in the history
…is_rare_earth` to include Y and Sc (#3817)

* make Sc and Y rare earth ele

* update docstring

* log breaking change

* revert removal of blank line

* update grace period

* add is_rare_earth and deprecate the old

* update `monty` to use `deadline`

* update monty to latest

---------

Signed-off-by: Shyue Ping Ong <shyuep@users.noreply.github.com>
Co-authored-by: Shyue Ping Ong <shyuep@users.noreply.github.com>
  • Loading branch information
DanielYang59 and shyuep authored May 30, 2024
1 parent a772ddb commit f214a5c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion pymatgen/core/periodic_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -696,10 +697,23 @@ 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.", deadline=(2025, 1, 1)
)
def is_rare_earth_metal(self) -> bool:
"""True if element is a rare earth metal."""
"""True if element is a rare earth metal, Lanthanides (La) series and Actinides (Ac) series.
This property is Deprecated, and scheduled for removal after 2025-01-01.
"""
return self.is_lanthanoid or self.is_actinoid

@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:
"""True if is a metal."""
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
numpy==1.26.0
sympy==1.12
requests==2.32.0
monty==2024.2.26
monty==2024.5.24
ruamel.yaml==0.18.6
scipy==1.11.3
tabulate==0.9.0
Expand Down

0 comments on commit f214a5c

Please sign in to comment.