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

breaking: move deepmd to deepmd.tf #3177

Merged
merged 3 commits into from
Jan 25, 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
2 changes: 1 addition & 1 deletion backend/read_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def get_argument_from_env() -> Tuple[str, list, list, dict, str]:
cmake_args.append(f"-DLAMMPS_VERSION={dp_lammps_version}")
if dp_ipi == "1":
cmake_args.append("-DENABLE_IPI:BOOL=TRUE")
extra_scripts["dp_ipi"] = "deepmd.entrypoints.ipi:dp_ipi"
extra_scripts["dp_ipi"] = "deepmd.tf.entrypoints.ipi:dp_ipi"

tf_install_dir, _ = find_tensorflow()
tf_version = get_tf_version(tf_install_dir)
Expand Down
50 changes: 0 additions & 50 deletions deepmd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,61 +1,11 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Root of the deepmd package, exposes all public classes and submodules."""

try:
from importlib import (
metadata,
)
except ImportError: # for Python<3.8
import importlib_metadata as metadata

import deepmd.utils.network as network

from . import (
cluster,
descriptor,
fit,
loss,
nvnmd,
utils,
)
from .env import (
set_mkl,
)
from .infer import (
DeepEval,
DeepPotential,
)
from .infer.data_modifier import (
DipoleChargeModifier,
)

set_mkl()

try:
from deepmd_utils._version import version as __version__
except ImportError:
from .__about__ import (
__version__,
)

# load third-party plugins
try:
eps = metadata.entry_points(group="deepmd")
except TypeError:
eps = metadata.entry_points().get("deepmd", [])
for ep in eps:
ep.load()

__all__ = [
"__version__",
"descriptor",
"fit",
"loss",
"utils",
"cluster",
"network",
"DeepEval",
"DeepPotential",
"DipoleChargeModifier",
"nvnmd",
]
File renamed without changes.
61 changes: 61 additions & 0 deletions deepmd/tf/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Root of the deepmd package, exposes all public classes and submodules."""

try:
from importlib import (
metadata,
)
except ImportError: # for Python<3.8
import importlib_metadata as metadata

import deepmd.tf.utils.network as network

from . import (
cluster,
descriptor,
fit,
loss,
nvnmd,
utils,
)
from .env import (
set_mkl,
)
from .infer import (
DeepEval,
DeepPotential,
)
from .infer.data_modifier import (
DipoleChargeModifier,
)

set_mkl()

try:
from deepmd_utils._version import version as __version__
except ImportError:
from .__about__ import (
__version__,
)

# load third-party plugins
try:
eps = metadata.entry_points(group="deepmd")
except TypeError:
eps = metadata.entry_points().get("deepmd", [])
for ep in eps:
ep.load()

__all__ = [
"__version__",
"descriptor",
"fit",
"loss",
"utils",
"cluster",
"network",
"DeepEval",
"DeepPotential",
"DipoleChargeModifier",
"nvnmd",
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion deepmd/cluster/local.py → deepmd/tf/cluster/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Tuple,
)

from deepmd.env import (
from deepmd.tf.env import (
tf,
)

Expand Down
2 changes: 1 addition & 1 deletion deepmd/cluster/slurm.py → deepmd/tf/cluster/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import hostlist

from deepmd.cluster import (
from deepmd.tf.cluster import (
local,
)

Expand Down
2 changes: 1 addition & 1 deletion deepmd/common.py → deepmd/tf/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
tensor_util,
)

from deepmd.env import (
from deepmd.tf.env import (
GLOBAL_TF_FLOAT_PRECISION,
op_module,
tf,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

import numpy as np

from deepmd.env import (
from deepmd.tf.env import (
GLOBAL_TF_FLOAT_PRECISION,
tf,
)
from deepmd.utils import (
from deepmd.tf.utils import (
Plugin,
PluginVariant,
)
Expand All @@ -34,7 +34,7 @@ class Descriptor(PluginVariant):
--------
>>> descript = Descriptor(type="se_e2_a", rcut=6., rcut_smth=0.5, sel=[50])
>>> type(descript)
<class 'deepmd.descriptor.se_a.DescrptSeA'>
<class 'deepmd.tf.descriptor.se_a.DescrptSeA'>

Notes
-----
Expand Down Expand Up @@ -174,18 +174,18 @@ def compute_input_stats(
----------
data_coord : list[np.ndarray]
The coordinates. Can be generated by
:meth:`deepmd.model.model_stat.make_stat_input`
:meth:`deepmd.tf.model.model_stat.make_stat_input`
data_box : list[np.ndarray]
The box. Can be generated by
:meth:`deepmd.model.model_stat.make_stat_input`
:meth:`deepmd.tf.model.model_stat.make_stat_input`
data_atype : list[np.ndarray]
The atom types. Can be generated by :meth:`deepmd.model.model_stat.make_stat_input`
The atom types. Can be generated by :meth:`deepmd.tf.model.model_stat.make_stat_input`
natoms_vec : list[np.ndarray]
The vector for the number of atoms of the system and different types of
atoms. Can be generated by :meth:`deepmd.model.model_stat.make_stat_input`
atoms. Can be generated by :meth:`deepmd.tf.model.model_stat.make_stat_input`
mesh : list[np.ndarray]
The mesh for neighbor searching. Can be generated by
:meth:`deepmd.model.model_stat.make_stat_input`
:meth:`deepmd.tf.model.model_stat.make_stat_input`
input_dict : dict[str, list[np.ndarray]]
Dictionary for additional input
**kwargs
Expand Down
26 changes: 13 additions & 13 deletions deepmd/descriptor/hybrid.py → deepmd/tf/descriptor/hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@

import numpy as np

from deepmd.env import (
from deepmd.tf.env import (
GLOBAL_TF_FLOAT_PRECISION,
tf,
)
from deepmd.utils.spin import (
from deepmd.tf.utils.spin import (
Spin,
)

# from deepmd.descriptor import DescrptLocFrame
# from deepmd.descriptor import DescrptSeA
# from deepmd.descriptor import DescrptSeT
# from deepmd.descriptor import DescrptSeAEbd
# from deepmd.descriptor import DescrptSeAEf
# from deepmd.descriptor import DescrptSeR
# from deepmd.tf.descriptor import DescrptLocFrame
# from deepmd.tf.descriptor import DescrptSeA
# from deepmd.tf.descriptor import DescrptSeT
# from deepmd.tf.descriptor import DescrptSeAEbd
# from deepmd.tf.descriptor import DescrptSeAEf
# from deepmd.tf.descriptor import DescrptSeR
from .descriptor import (
Descriptor,
)
Expand Down Expand Up @@ -146,15 +146,15 @@ def compute_input_stats(
Parameters
----------
data_coord
The coordinates. Can be generated by deepmd.model.make_stat_input
The coordinates. Can be generated by deepmd.tf.model.make_stat_input
data_box
The box. Can be generated by deepmd.model.make_stat_input
The box. Can be generated by deepmd.tf.model.make_stat_input
data_atype
The atom types. Can be generated by deepmd.model.make_stat_input
The atom types. Can be generated by deepmd.tf.model.make_stat_input
natoms_vec
The vector for the number of atoms of the system and different types of atoms. Can be generated by deepmd.model.make_stat_input
The vector for the number of atoms of the system and different types of atoms. Can be generated by deepmd.tf.model.make_stat_input
mesh
The mesh for neighbor searching. Can be generated by deepmd.model.make_stat_input
The mesh for neighbor searching. Can be generated by deepmd.tf.model.make_stat_input
input_dict
Dictionary for additional input
mixed_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

import numpy as np

from deepmd.env import (
from deepmd.tf.env import (
GLOBAL_NP_FLOAT_PRECISION,
GLOBAL_TF_FLOAT_PRECISION,
default_tf_session_config,
op_module,
tf,
)
from deepmd.utils.graph import (
from deepmd.tf.utils.graph import (
get_tensor_by_name_from_graph,
)
from deepmd.utils.sess import (
from deepmd.tf.utils.sess import (
run_sess,
)

Expand Down Expand Up @@ -168,15 +168,15 @@ def compute_input_stats(
Parameters
----------
data_coord
The coordinates. Can be generated by deepmd.model.make_stat_input
The coordinates. Can be generated by deepmd.tf.model.make_stat_input
data_box
The box. Can be generated by deepmd.model.make_stat_input
The box. Can be generated by deepmd.tf.model.make_stat_input
data_atype
The atom types. Can be generated by deepmd.model.make_stat_input
The atom types. Can be generated by deepmd.tf.model.make_stat_input
natoms_vec
The vector for the number of atoms of the system and different types of atoms. Can be generated by deepmd.model.make_stat_input
The vector for the number of atoms of the system and different types of atoms. Can be generated by deepmd.tf.model.make_stat_input
mesh
The mesh for neighbor searching. Can be generated by deepmd.model.make_stat_input
The mesh for neighbor searching. Can be generated by deepmd.tf.model.make_stat_input
input_dict
Dictionary for additional input
**kwargs
Expand Down
8 changes: 4 additions & 4 deletions deepmd/descriptor/se.py → deepmd/tf/descriptor/se.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
Tuple,
)

from deepmd.env import (
from deepmd.tf.env import (
tf,
)
from deepmd.utils.graph import (
from deepmd.tf.utils.graph import (
get_embedding_net_variables_from_graph_def,
get_tensor_by_name_from_graph,
)
Expand All @@ -22,7 +22,7 @@ class DescrptSe(Descriptor):
Notes
-----
All of these descriptors have an environmental matrix and an
embedding network (:meth:`deepmd.utils.network.embedding_net`), so
embedding network (:meth:`deepmd.tf.utils.network.embedding_net`), so
they can share some similiar methods without defining them twice.

Attributes
Expand Down Expand Up @@ -153,7 +153,7 @@ def update_sel(cls, global_jdata: dict, local_jdata: dict):
local_jdata : dict
The local data refer to the current class
"""
from deepmd.entrypoints.train import (
from deepmd.tf.entrypoints.train import (
update_one_sel,
)

Expand Down
Loading
Loading