Skip to content

Commit 2fe6927

Browse files
authored
merge devel into master (#2917)
Prepare v2.2.6.
2 parents 477b785 + fc09e77 commit 2fe6927

File tree

111 files changed

+5285
-18135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+5285
-18135
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# do not show up detailed difference on GitHub
2+
source/3rdparty/* linguist-generated=true

.github/workflows/build_wheel.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ jobs:
7676
runs-on: ubuntu-latest
7777
steps:
7878
- uses: actions/checkout@v4
79+
with:
80+
fetch-depth: 0
7981
- uses: actions/setup-python@v4
8082
name: Install Python
8183
with:

.github/workflows/test_cuda.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ jobs:
99
test_cuda:
1010
name: Test Python and C++ on CUDA
1111
runs-on: nvidia
12+
# https://github.com/deepmodeling/deepmd-kit/pull/2884#issuecomment-1744216845
13+
container:
14+
image: nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
15+
options: --gpus all
1216
if: github.repository_owner == 'deepmodeling' && github.event.label.name == 'Test CUDA' || github.event_name == 'workflow_dispatch'
1317
steps:
18+
- name: Make sudo and git work
19+
run: apt-get update && apt-get install -y sudo git
1420
- uses: actions/checkout@v4
1521
- uses: actions/setup-python@v4
1622
with:
1723
python-version: '3.11'
18-
cache: 'pip'
24+
# cache: 'pip'
1925
- name: Setup MPI
2026
uses: mpi4py/setup-mpi@v1
2127
with:
@@ -26,14 +32,17 @@ jobs:
2632
&& sudo dpkg -i cuda-keyring_1.0-1_all.deb \
2733
&& sudo apt-get update \
2834
&& sudo apt-get -y install cuda-11-8 libcudnn8=8.9.5.*-1+cuda11.8
35+
if: false # skip as we use nvidia image
36+
- name: Set PyPI mirror for Aliyun cloud machine
37+
run: python -m pip config --user set global.index-url https://mirrors.aliyun.com/pypi/simple/
2938
- run: python -m pip install -U "pip>=21.3.1,!=23.0.0"
30-
- run: pip install -v -e .[gpu,test,lmp,cu11] "ase @ https://github.com/rosswhitfield/ase/archive/edd03571aff6944b77b4a4b055239f3c3e4eeb66.zip"
39+
- run: python -m pip install -v -e .[gpu,test,lmp,cu11] "ase @ https://github.com/rosswhitfield/ase/archive/edd03571aff6944b77b4a4b055239f3c3e4eeb66.zip"
3140
env:
3241
DP_BUILD_TESTING: 1
3342
DP_VARIANT: cuda
3443
CUDA_PATH: /usr/local/cuda-11.8
3544
- run: dp --version
36-
- run: pytest -s --cov=deepmd --cov=deepmd_cli source/tests --durations=0
45+
- run: python -m pytest -s --cov=deepmd --cov=deepmd_cli source/tests --durations=0
3746
- run: source/install/test_cc_local.sh
3847
env:
3948
OMP_NUM_THREADS: 1
@@ -45,10 +54,10 @@ jobs:
4554
DP_USE_MPICH2: 1
4655
CUDA_PATH: /usr/local/cuda-11.8
4756
- run: |
48-
export LD_LIBRARY_PATH=${{ github.workspace }}/dp_test/lib:$CUDA_PATH/lib64:$LD_LIBRARY_PATH
49-
export PATH=${{ github.workspace }}/dp_test/bin:$PATH
50-
pytest -s --cov=deepmd source/lmp/tests
51-
pytest -s --cov=deepmd source/ipi/tests
57+
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/dp_test/lib:$CUDA_PATH/lib64:$LD_LIBRARY_PATH
58+
export PATH=$GITHUB_WORKSPACE/dp_test/bin:$PATH
59+
python -m pytest -s --cov=deepmd source/lmp/tests
60+
python -m pytest -s --cov=deepmd source/ipi/tests
5261
env:
5362
OMP_NUM_THREADS: 1
5463
TF_INTRA_OP_PARALLELISM_THREADS: 1

.pre-commit-config.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.4.0
5+
rev: v4.5.0
66
hooks:
77
- id: trailing-whitespace
88
exclude: "^.+\\.pbtxt$"
@@ -27,22 +27,26 @@ repos:
2727
hooks:
2828
- id: isort
2929
files: \.py$
30+
exclude: ^source/3rdparty
3031
- repo: https://github.com/astral-sh/ruff-pre-commit
3132
# Ruff version.
32-
rev: v0.0.291
33+
rev: v0.0.292
3334
hooks:
3435
- id: ruff
3536
args: ["--fix"]
37+
exclude: ^source/3rdparty
3638
- repo: https://github.com/psf/black-pre-commit-mirror
3739
rev: 23.9.1
3840
hooks:
3941
- id: black-jupyter
42+
exclude: ^source/3rdparty
4043
# numpydoc
4144
- repo: https://github.com/Carreau/velin
4245
rev: 0.0.12
4346
hooks:
4447
- id: velin
4548
args: ["--write"]
49+
exclude: ^source/3rdparty
4650
# Python inside docs
4751
- repo: https://github.com/asottile/blacken-docs
4852
rev: 1.16.0
@@ -102,6 +106,7 @@ repos:
102106
- --comment-style
103107
- "#"
104108
- --no-extra-eol
109+
exclude: ^source/3rdparty
105110
# HTML
106111
- id: insert-license
107112
files: \.(html|vue|xml)$

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ A full [document](doc/train/train-input-auto.rst) on options in the training inp
9292
- [Install GROMACS](doc/install/install-gromacs.md)
9393
- [Building conda packages](doc/install/build-conda.md)
9494
- [Install Node.js interface](doc/install/install-nodejs.md)
95+
- [Easy install the latest development version](doc/install/easy-install-dev.md)
9596
- [Data](doc/data/index.md)
9697
- [System](doc/data/system.md)
9798
- [Formats of a system](doc/data/data-conv.md)

backend/dynamic_metadata.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def dynamic_metadata(
3838
"pytest",
3939
"pytest-cov",
4040
"pytest-sugar",
41+
"dpgui",
4142
],
4243
"docs": [
4344
"sphinx>=3.1.1",
@@ -62,6 +63,9 @@ def dynamic_metadata(
6263
"i-PI",
6364
*find_libpython_requires,
6465
],
66+
"gui": [
67+
"dpgui",
68+
],
6569
**get_tf_requirement(tf_version),
6670
"cu11": [
6771
"nvidia-cuda-runtime-cu11",

deepmd/descriptor/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
from .se_a_ebd import (
1515
DescrptSeAEbd,
1616
)
17+
from .se_a_ebd_v2 import (
18+
DescrptSeAEbdV2,
19+
)
1720
from .se_a_ef import (
1821
DescrptSeAEf,
1922
DescrptSeAEfLower,
@@ -39,6 +42,7 @@
3942
"DescrptHybrid",
4043
"DescrptLocFrame",
4144
"DescrptSeA",
45+
"DescrptSeAEbdV2",
4246
"DescrptSeAEbd",
4347
"DescrptSeAEf",
4448
"DescrptSeAEfLower",

deepmd/descriptor/descriptor.py

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,20 @@ class SomeDescript(Descriptor):
6666
"""
6767
return Descriptor.__plugins.register(key)
6868

69+
@classmethod
70+
def get_class_by_input(cls, input: dict):
71+
try:
72+
descrpt_type = input["type"]
73+
except KeyError:
74+
raise KeyError("the type of descriptor should be set by `type`")
75+
if descrpt_type in Descriptor.__plugins.plugins:
76+
return Descriptor.__plugins.plugins[descrpt_type]
77+
else:
78+
raise RuntimeError("Unknown descriptor type: " + descrpt_type)
79+
6980
def __new__(cls, *args, **kwargs):
7081
if cls is Descriptor:
71-
try:
72-
descrpt_type = kwargs["type"]
73-
except KeyError:
74-
raise KeyError("the type of descriptor should be set by `type`")
75-
if descrpt_type in Descriptor.__plugins.plugins:
76-
cls = Descriptor.__plugins.plugins[descrpt_type]
77-
else:
78-
raise RuntimeError("Unknown descriptor type: " + descrpt_type)
82+
cls = cls.get_class_by_input(kwargs)
7983
return super().__new__(cls)
8084

8185
@abstractmethod
@@ -489,3 +493,19 @@ def build_type_exclude_mask(
489493
def explicit_ntypes(self) -> bool:
490494
"""Explicit ntypes with type embedding."""
491495
return False
496+
497+
@classmethod
498+
@abstractmethod
499+
def update_sel(cls, global_jdata: dict, local_jdata: dict):
500+
"""Update the selection and perform neighbor statistics.
501+
502+
Parameters
503+
----------
504+
global_jdata : dict
505+
The global data, containing the training section
506+
local_jdata : dict
507+
The local data refer to the current class
508+
"""
509+
# call subprocess
510+
cls = cls.get_class_by_input(local_jdata)
511+
return cls.update_sel(global_jdata, local_jdata)

deepmd/descriptor/hybrid.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,3 +416,21 @@ def pass_tensors_from_frz_model(
416416
def explicit_ntypes(self) -> bool:
417417
"""Explicit ntypes with type embedding."""
418418
return any(ii.explicit_ntypes for ii in self.descrpt_list)
419+
420+
@classmethod
421+
def update_sel(cls, global_jdata: dict, local_jdata: dict):
422+
"""Update the selection and perform neighbor statistics.
423+
424+
Parameters
425+
----------
426+
global_jdata : dict
427+
The global data, containing the training section
428+
local_jdata : dict
429+
The local data refer to the current class
430+
"""
431+
local_jdata_cpy = local_jdata.copy()
432+
local_jdata_cpy["list"] = [
433+
Descriptor.update_sel(global_jdata, sub_jdata)
434+
for sub_jdata in local_jdata["list"]
435+
]
436+
return local_jdata_cpy

deepmd/descriptor/loc_frame.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,3 +430,16 @@ def init_variables(
430430
self.dstd = get_tensor_by_name_from_graph(
431431
graph, "descrpt_attr%s/t_std" % suffix
432432
)
433+
434+
@classmethod
435+
def update_sel(cls, global_jdata: dict, local_jdata: dict):
436+
"""Update the selection and perform neighbor statistics.
437+
438+
Parameters
439+
----------
440+
global_jdata : dict
441+
The global data, containing the training section
442+
local_jdata : dict
443+
The local data refer to the current class
444+
"""
445+
return local_jdata

0 commit comments

Comments
 (0)