Skip to content
代码片段 群组 项目
未验证 提交 f214a5cf 编辑于 作者: Haoyu (Daniel)'s avatar Haoyu (Daniel) 提交者: GitHub
浏览文件

[Deprecation] Replace `Element` property `is_rare_earth_metal` with...

[Deprecation] Replace `Element` property `is_rare_earth_metal` with `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: default avatarShyue Ping Ong <shyuep@users.noreply.github.com>
Co-authored-by: default avatarShyue Ping Ong <shyuep@users.noreply.github.com>
上级 a772ddb0
无相关合并请求
......@@ -14,6 +14,7 @@ from pathlib import Path
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,10 +697,23 @@ class ElementBase(Enum):
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."""
......
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
......
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册