Skip to content

Commit

Permalink
fix: add mendeleev to dependencies; remove dpdata; remove catching Im…
Browse files Browse the repository at this point in the history
…portError (#3878)

Fix #3743.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Chores**
- Consolidated imports and removed redundant exception handling for
`dpdata` and `mendeleev`.
- Updated dependencies in `pyproject.toml` to include `mendeleev` in the
main section and update packages for testing and documentation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
njzjz and pre-commit-ci[bot] authored Jun 14, 2024
1 parent c644314 commit d23f7ae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
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

0 comments on commit d23f7ae

Please sign in to comment.