Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add mendeleev to dependencies; remove dpdata; remove catching ImportError #3878

Merged
merged 5 commits into from
Jun 14, 2024
Merged
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
13 changes: 4 additions & 9 deletions deepmd/utils/econf_embd.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
import numpy as np

try:
import dpdata
from mendeleev import (
element,
)
except ImportError:
pass
from mendeleev import (
element,
)

###
# made by command
Expand Down Expand Up @@ -173,7 +168,7 @@
maxl = maxn
maxm = 2 * maxl + 1

type_map = dpdata.periodic_table.ELEMENTS
type_map = list(electronic_configuration_embedding.keys())
ECONF_DIM = electronic_configuration_embedding[type_map[0]].shape[0]


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ dependencies = [
'wcmatch',
'packaging',
'ml_dtypes',
'mendeleev',
]
requires-python = ">=3.8"
keywords = ["deepmd"]
Expand Down Expand Up @@ -78,7 +79,6 @@ test = [
"pytest-sugar",
"pytest-split",
"dpgui",
"mendeleev",
]
docs = [
"sphinx>=3.1.1",
Expand Down
8 changes: 0 additions & 8 deletions source/tests/common/test_econf_embd.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@
make_econf_embedding,
)

try:
import mendeleev # noqa: F401

has_mendeleev = True
except ImportError:
has_mendeleev = False


@unittest.skipIf(not has_mendeleev, "does not have mendeleev installed, skip the UTs.")
class TestEConfEmbd(unittest.TestCase):
def test_fe(self):
res = make_econf_embedding(["Fe"], flatten=False)["Fe"]
Expand Down