-
Notifications
You must be signed in to change notification settings - Fork 608
Expand file tree
/
Copy path__init__.py
More file actions
78 lines (63 loc) · 1.82 KB
/
__init__.py
File metadata and controls
78 lines (63 loc) · 1.82 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# SPDX-License-Identifier: LGPL-3.0-or-later
"""DeePMD-kit is a package written in Python/C++, designed to
minimize the effort required to build deep learning-based model
of interatomic potential energy and force field and to perform
molecular dynamics (MD).
The top module (deepmd.__init__) should not import any third-party
modules for performance.
"""
from typing import (
TYPE_CHECKING,
Any,
)
if TYPE_CHECKING:
from deepmd.infer import DeepPotential as DeepPotentialType
from deepmd.property import (
PropertyPredictor,
PropertyTrainer,
)
try:
from deepmd._version import version as __version__
except ImportError:
from .__about__ import (
__version__,
)
def DeepPotential(*args: Any, **kwargs: Any) -> "DeepPotentialType":
"""Factory function that forwards to DeepEval (for compatibility
and performance).
Parameters
----------
*args
positional arguments
**kwargs
keyword arguments
Returns
-------
DeepEval
potentials
"""
from deepmd.infer import (
DeepPotential,
)
return DeepPotential(*args, **kwargs)
def __getattr__(name: str) -> Any:
"""Lazily expose optional high-level helpers.
The top-level module should avoid importing third-party-heavy modules at
import time for performance. Keep these exports lazy.
"""
if name in {"PropertyPredictor", "PropertyTrainer"}:
from .property import (
PropertyPredictor,
PropertyTrainer,
)
return {
"PropertyPredictor": PropertyPredictor,
"PropertyTrainer": PropertyTrainer,
}[name]
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
__all__ = [
"DeepPotential",
"PropertyPredictor",
"PropertyTrainer",
"__version__",
]