forked from deepmodeling/deepmd-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdp_model.py
More file actions
54 lines (46 loc) · 1.51 KB
/
Copy pathdp_model.py
File metadata and controls
54 lines (46 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# SPDX-License-Identifier: LGPL-3.0-or-later
from deepmd.dpmodel.descriptor.base_descriptor import (
BaseDescriptor,
)
from deepmd.dpmodel.fitting.base_fitting import (
BaseFitting,
)
from deepmd.utils.data_system import (
DeepmdDataSystem,
)
# use "class" to resolve "Variable not allowed in type expression"
class DPModelCommon:
@classmethod
def update_sel(
cls,
train_data: DeepmdDataSystem,
type_map: list[str] | None,
local_jdata: dict,
) -> tuple[dict, float | None]:
"""Update the selection and perform neighbor statistics.
Parameters
----------
train_data : DeepmdDataSystem
data used to do neighbor statistics
type_map : list[str], optional
The name of each type of atoms
local_jdata : dict
The local data refer to the current class
Returns
-------
dict
The updated local data
float
The minimum distance between two atoms
"""
local_jdata_cpy = local_jdata.copy()
local_jdata_cpy["descriptor"], min_nbor_dist = BaseDescriptor.update_sel(
train_data, type_map, local_jdata["descriptor"]
)
return local_jdata_cpy, min_nbor_dist
def get_fitting_net(self) -> BaseFitting:
"""Get the fitting network."""
return self.atomic_model.fitting
def get_descriptor(self) -> BaseDescriptor:
"""Get the descriptor."""
return self.atomic_model.descriptor