diff --git a/backend/read_env.py b/backend/read_env.py index 079211d4d7..ba6bf5f9f3 100644 --- a/backend/read_env.py +++ b/backend/read_env.py @@ -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) diff --git a/deepmd/__init__.py b/deepmd/__init__.py index 0190bbc124..5fc690b94f 100644 --- a/deepmd/__init__.py +++ b/deepmd/__init__.py @@ -1,36 +1,4 @@ # 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: @@ -38,24 +6,6 @@ __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", ] diff --git a/deepmd/__about__.py b/deepmd/tf/__about__.py similarity index 100% rename from deepmd/__about__.py rename to deepmd/tf/__about__.py diff --git a/deepmd/tf/__init__.py b/deepmd/tf/__init__.py new file mode 100644 index 0000000000..faa0b20bab --- /dev/null +++ b/deepmd/tf/__init__.py @@ -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", +] diff --git a/deepmd/__main__.py b/deepmd/tf/__main__.py similarity index 100% rename from deepmd/__main__.py rename to deepmd/tf/__main__.py diff --git a/deepmd/calculator.py b/deepmd/tf/calculator.py similarity index 100% rename from deepmd/calculator.py rename to deepmd/tf/calculator.py diff --git a/deepmd/cluster/__init__.py b/deepmd/tf/cluster/__init__.py similarity index 100% rename from deepmd/cluster/__init__.py rename to deepmd/tf/cluster/__init__.py diff --git a/deepmd/cluster/local.py b/deepmd/tf/cluster/local.py similarity index 98% rename from deepmd/cluster/local.py rename to deepmd/tf/cluster/local.py index 3c12c9dc85..bd0e4c86aa 100644 --- a/deepmd/cluster/local.py +++ b/deepmd/tf/cluster/local.py @@ -10,7 +10,7 @@ Tuple, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) diff --git a/deepmd/cluster/slurm.py b/deepmd/tf/cluster/slurm.py similarity index 97% rename from deepmd/cluster/slurm.py rename to deepmd/tf/cluster/slurm.py index 5264622232..7a7ebcee3e 100644 --- a/deepmd/cluster/slurm.py +++ b/deepmd/tf/cluster/slurm.py @@ -15,7 +15,7 @@ import hostlist -from deepmd.cluster import ( +from deepmd.tf.cluster import ( local, ) diff --git a/deepmd/common.py b/deepmd/tf/common.py similarity index 99% rename from deepmd/common.py rename to deepmd/tf/common.py index 54e3d0a6f8..9860f82017 100644 --- a/deepmd/common.py +++ b/deepmd/tf/common.py @@ -17,7 +17,7 @@ tensor_util, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, op_module, tf, diff --git a/deepmd/descriptor/__init__.py b/deepmd/tf/descriptor/__init__.py similarity index 100% rename from deepmd/descriptor/__init__.py rename to deepmd/tf/descriptor/__init__.py diff --git a/deepmd/descriptor/descriptor.py b/deepmd/tf/descriptor/descriptor.py similarity index 97% rename from deepmd/descriptor/descriptor.py rename to deepmd/tf/descriptor/descriptor.py index bd731004cb..9bdda3ec37 100644 --- a/deepmd/descriptor/descriptor.py +++ b/deepmd/tf/descriptor/descriptor.py @@ -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, ) @@ -34,7 +34,7 @@ class Descriptor(PluginVariant): -------- >>> descript = Descriptor(type="se_e2_a", rcut=6., rcut_smth=0.5, sel=[50]) >>> type(descript) - + Notes ----- @@ -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 diff --git a/deepmd/descriptor/hybrid.py b/deepmd/tf/descriptor/hybrid.py similarity index 95% rename from deepmd/descriptor/hybrid.py rename to deepmd/tf/descriptor/hybrid.py index 5ee5ec884b..8ce8acc4db 100644 --- a/deepmd/descriptor/hybrid.py +++ b/deepmd/tf/descriptor/hybrid.py @@ -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, ) @@ -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 diff --git a/deepmd/descriptor/loc_frame.py b/deepmd/tf/descriptor/loc_frame.py similarity index 97% rename from deepmd/descriptor/loc_frame.py rename to deepmd/tf/descriptor/loc_frame.py index 0765be55f8..b43678c381 100644 --- a/deepmd/descriptor/loc_frame.py +++ b/deepmd/tf/descriptor/loc_frame.py @@ -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, ) @@ -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 diff --git a/deepmd/descriptor/se.py b/deepmd/tf/descriptor/se.py similarity index 95% rename from deepmd/descriptor/se.py rename to deepmd/tf/descriptor/se.py index 598f6f9ff8..4f49a8800f 100644 --- a/deepmd/descriptor/se.py +++ b/deepmd/tf/descriptor/se.py @@ -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, ) @@ -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 @@ -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, ) diff --git a/deepmd/descriptor/se_a.py b/deepmd/tf/descriptor/se_a.py similarity index 98% rename from deepmd/descriptor/se_a.py rename to deepmd/tf/descriptor/se_a.py index 721bb0d534..f1f90451fc 100644 --- a/deepmd/descriptor/se_a.py +++ b/deepmd/tf/descriptor/se_a.py @@ -7,20 +7,20 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( cast_precision, get_activation_func, get_np_precision, get_precision, ) -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.nvnmd.descriptor.se_a import ( +from deepmd.tf.nvnmd.descriptor.se_a import ( build_davg_dstd, build_op_descriptor, check_switch_range, @@ -28,38 +28,38 @@ filter_GR2D, filter_lower_R42GR, ) -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) -from deepmd.utils.compress import ( +from deepmd.tf.utils.compress import ( get_extra_side_embedding_net_variable, get_two_side_type_embedding, get_type_embedding, make_data, ) -from deepmd.utils.errors import ( +from deepmd.tf.utils.errors import ( GraphWithoutTensorError, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_extra_embedding_net_suffix, get_extra_embedding_net_variables_from_graph_def, get_pattern_nodes_from_graph_def, get_tensor_by_name_from_graph, ) -from deepmd.utils.network import ( +from deepmd.tf.utils.network import ( embedding_net, embedding_net_rand_seed_shift, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) -from deepmd.utils.spin import ( +from deepmd.tf.utils.spin import ( Spin, ) -from deepmd.utils.tabulate import ( +from deepmd.tf.utils.tabulate import ( DPTabulate, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( embed_atom_type, ) @@ -112,7 +112,7 @@ class DescrptSeA(DescrptSe): :math:`\mathcal{G}^i_< \in \mathbb{R}^{N \times M_2}` takes first :math:`M_2` columns of :math:`\mathcal{G}^i`. The equation of embedding network :math:`\mathcal{N}` can be found at - :meth:`deepmd.utils.network.embedding_net`. + :meth:`deepmd.tf.utils.network.embedding_net`. Parameters ---------- @@ -333,15 +333,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 diff --git a/deepmd/descriptor/se_a_ebd.py b/deepmd/tf/descriptor/se_a_ebd.py similarity index 99% rename from deepmd/descriptor/se_a_ebd.py rename to deepmd/tf/descriptor/se_a_ebd.py index 4816ec1569..92b194b37a 100644 --- a/deepmd/descriptor/se_a_ebd.py +++ b/deepmd/tf/descriptor/se_a_ebd.py @@ -6,15 +6,15 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( add_data_requirement, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, op_module, tf, ) -from deepmd.utils.network import ( +from deepmd.tf.utils.network import ( embedding_net, one_layer, ) diff --git a/deepmd/descriptor/se_a_ebd_v2.py b/deepmd/tf/descriptor/se_a_ebd_v2.py similarity index 98% rename from deepmd/descriptor/se_a_ebd_v2.py rename to deepmd/tf/descriptor/se_a_ebd_v2.py index c6e3cebc71..54790fbfed 100644 --- a/deepmd/descriptor/se_a_ebd_v2.py +++ b/deepmd/tf/descriptor/se_a_ebd_v2.py @@ -5,7 +5,7 @@ Optional, ) -from deepmd.utils.spin import ( +from deepmd.tf.utils.spin import ( Spin, ) diff --git a/deepmd/descriptor/se_a_ef.py b/deepmd/tf/descriptor/se_a_ef.py similarity index 97% rename from deepmd/descriptor/se_a_ef.py rename to deepmd/tf/descriptor/se_a_ef.py index 32a62b48f3..0c2b78162b 100644 --- a/deepmd/descriptor/se_a_ef.py +++ b/deepmd/tf/descriptor/se_a_ef.py @@ -7,17 +7,17 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( add_data_requirement, ) -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.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) @@ -180,15 +180,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 diff --git a/deepmd/descriptor/se_a_mask.py b/deepmd/tf/descriptor/se_a_mask.py similarity index 96% rename from deepmd/descriptor/se_a_mask.py rename to deepmd/tf/descriptor/se_a_mask.py index cc2e6b4fc8..55b34adf48 100644 --- a/deepmd/descriptor/se_a_mask.py +++ b/deepmd/tf/descriptor/se_a_mask.py @@ -10,18 +10,18 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( get_activation_func, get_precision, ) -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.network import ( +from deepmd.tf.utils.network import ( embedding_net_rand_seed_shift, ) @@ -73,7 +73,7 @@ class DescrptSeAMask(DescrptSeA): :math:`\mathcal{G}^i_< \in \mathbb{R}^{N \times M_2}` takes first :math:`M_2` columns of :math:`\mathcal{G}^i`. The equation of embedding network :math:`\mathcal{N}` can be found at - :meth:`deepmd.utils.network.embedding_net`. + :meth:`deepmd.tf.utils.network.embedding_net`. Specially for descriptor se_a_mask is a concise implementation of se_a. The difference is that se_a_mask only considered a non-pbc system. And accept a mask matrix to indicate the atom i in frame j is a real atom or not. @@ -235,15 +235,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 diff --git a/deepmd/descriptor/se_atten.py b/deepmd/tf/descriptor/se_atten.py similarity index 98% rename from deepmd/descriptor/se_atten.py rename to deepmd/tf/descriptor/se_atten.py index 1ceda23065..327c3c1d3d 100644 --- a/deepmd/descriptor/se_atten.py +++ b/deepmd/tf/descriptor/se_atten.py @@ -12,11 +12,11 @@ Version, ) -from deepmd.common import ( +from deepmd.tf.common import ( cast_precision, get_np_precision, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, GLOBAL_TF_FLOAT_PRECISION, TF_VERSION, @@ -24,7 +24,7 @@ op_module, tf, ) -from deepmd.nvnmd.descriptor.se_atten import ( +from deepmd.tf.nvnmd.descriptor.se_atten import ( build_davg_dstd, build_op_descriptor, check_switch_range, @@ -32,29 +32,29 @@ filter_GR2D, filter_lower_R42GR, ) -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) -from deepmd.utils.compress import ( +from deepmd.tf.utils.compress import ( get_extra_side_embedding_net_variable, get_two_side_type_embedding, make_data, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_attention_layer_variables_from_graph_def, get_extra_embedding_net_suffix, get_extra_embedding_net_variables_from_graph_def, get_pattern_nodes_from_graph_def, get_tensor_by_name_from_graph, ) -from deepmd.utils.network import ( +from deepmd.tf.utils.network import ( embedding_net, one_layer, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) -from deepmd.utils.tabulate import ( +from deepmd.tf.utils.tabulate import ( DPTabulate, ) @@ -269,16 +269,16 @@ 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. If mixed_type is True, this para is blank. See real_natoms_vec. 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 @@ -1339,7 +1339,7 @@ def build_type_exclude_mask( Notes ----- This method has the similiar way to build the type exclude mask as - :meth:`deepmd.descriptor.descriptor.Descriptor.build_type_exclude_mask`. + :meth:`deepmd.tf.descriptor.descriptor.Descriptor.build_type_exclude_mask`. The mathmatical expression has been explained in that method. The difference is that the attention descriptor has provided the type of the neighbors (idx_j) that is not in order, so we use it from an extra @@ -1373,7 +1373,7 @@ def build_type_exclude_mask( See Also -------- - deepmd.descriptor.descriptor.Descriptor.build_type_exclude_mask + deepmd.tf.descriptor.descriptor.Descriptor.build_type_exclude_mask """ # generate a mask # op returns ntypes when the neighbor doesn't exist, so we need to add 1 @@ -1424,7 +1424,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, ) diff --git a/deepmd/descriptor/se_atten_v2.py b/deepmd/tf/descriptor/se_atten_v2.py similarity index 100% rename from deepmd/descriptor/se_atten_v2.py rename to deepmd/tf/descriptor/se_atten_v2.py diff --git a/deepmd/descriptor/se_r.py b/deepmd/tf/descriptor/se_r.py similarity index 97% rename from deepmd/descriptor/se_r.py rename to deepmd/tf/descriptor/se_r.py index ae926c339f..ac94ec0614 100644 --- a/deepmd/descriptor/se_r.py +++ b/deepmd/tf/descriptor/se_r.py @@ -7,32 +7,32 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( cast_precision, get_activation_func, get_precision, ) -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.network import ( +from deepmd.tf.utils.network import ( embedding_net, embedding_net_rand_seed_shift, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) -from deepmd.utils.spin import ( +from deepmd.tf.utils.spin import ( Spin, ) -from deepmd.utils.tabulate import ( +from deepmd.tf.utils.tabulate import ( DPTabulate, ) @@ -235,15 +235,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 diff --git a/deepmd/descriptor/se_t.py b/deepmd/tf/descriptor/se_t.py similarity index 97% rename from deepmd/descriptor/se_t.py rename to deepmd/tf/descriptor/se_t.py index d0c9fcbc2e..98f4cf8212 100644 --- a/deepmd/descriptor/se_t.py +++ b/deepmd/tf/descriptor/se_t.py @@ -7,29 +7,29 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( cast_precision, get_activation_func, get_precision, ) -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.network import ( +from deepmd.tf.utils.network import ( embedding_net, embedding_net_rand_seed_shift, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) -from deepmd.utils.tabulate import ( +from deepmd.tf.utils.tabulate import ( DPTabulate, ) @@ -225,15 +225,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 diff --git a/deepmd/entrypoints/__init__.py b/deepmd/tf/entrypoints/__init__.py similarity index 100% rename from deepmd/entrypoints/__init__.py rename to deepmd/tf/entrypoints/__init__.py diff --git a/deepmd/entrypoints/compress.py b/deepmd/tf/entrypoints/compress.py similarity index 96% rename from deepmd/entrypoints/compress.py rename to deepmd/tf/entrypoints/compress.py index 61d6dfcb44..b1273b92e1 100644 --- a/deepmd/entrypoints/compress.py +++ b/deepmd/tf/entrypoints/compress.py @@ -8,24 +8,24 @@ Optional, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_loader, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_ENER_FLOAT_PRECISION, tf, ) -from deepmd.utils.argcheck import ( +from deepmd.tf.utils.argcheck import ( normalize, ) -from deepmd.utils.compat import ( +from deepmd.tf.utils.compat import ( update_deepmd_input, ) -from deepmd.utils.errors import ( +from deepmd.tf.utils.errors import ( GraphTooLargeError, GraphWithoutTensorError, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_tensor_by_name_from_graph, load_graph_def, ) diff --git a/deepmd/entrypoints/convert.py b/deepmd/tf/entrypoints/convert.py similarity index 97% rename from deepmd/entrypoints/convert.py rename to deepmd/tf/entrypoints/convert.py index bea047ba72..17c8667362 100644 --- a/deepmd/entrypoints/convert.py +++ b/deepmd/tf/entrypoints/convert.py @@ -1,5 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_10_to_21, convert_012_to_21, convert_12_to_21, diff --git a/deepmd/entrypoints/doc.py b/deepmd/tf/entrypoints/doc.py similarity index 100% rename from deepmd/entrypoints/doc.py rename to deepmd/tf/entrypoints/doc.py diff --git a/deepmd/entrypoints/freeze.py b/deepmd/tf/entrypoints/freeze.py similarity index 98% rename from deepmd/entrypoints/freeze.py rename to deepmd/tf/entrypoints/freeze.py index 22f3cb80b4..9cb59f4c9d 100755 --- a/deepmd/entrypoints/freeze.py +++ b/deepmd/tf/entrypoints/freeze.py @@ -21,22 +21,22 @@ import google.protobuf.message # load grad of force module -import deepmd.op # noqa: F401 -from deepmd.env import ( +import deepmd.tf.op # noqa: F401 +from deepmd.tf.env import ( FITTING_NET_PATTERN, REMOVE_SUFFIX_DICT, tf, ) -from deepmd.nvnmd.entrypoints.freeze import ( +from deepmd.tf.nvnmd.entrypoints.freeze import ( save_weight, ) -from deepmd.utils.errors import ( +from deepmd.tf.utils.errors import ( GraphTooLargeError, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_pattern_nodes_from_graph_def, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) diff --git a/deepmd/entrypoints/gui.py b/deepmd/tf/entrypoints/gui.py similarity index 100% rename from deepmd/entrypoints/gui.py rename to deepmd/tf/entrypoints/gui.py diff --git a/deepmd/entrypoints/ipi.py b/deepmd/tf/entrypoints/ipi.py similarity index 95% rename from deepmd/entrypoints/ipi.py rename to deepmd/tf/entrypoints/ipi.py index da287ff3de..49f72434f3 100644 --- a/deepmd/entrypoints/ipi.py +++ b/deepmd/tf/entrypoints/ipi.py @@ -7,7 +7,7 @@ List, ) -from deepmd.lmp import ( +from deepmd.tf.lmp import ( get_op_dir, ) diff --git a/deepmd/entrypoints/main.py b/deepmd/tf/entrypoints/main.py similarity index 94% rename from deepmd/entrypoints/main.py rename to deepmd/tf/entrypoints/main.py index 2c6ac26a7f..21f5e10aa9 100644 --- a/deepmd/entrypoints/main.py +++ b/deepmd/tf/entrypoints/main.py @@ -11,10 +11,10 @@ Union, ) -from deepmd.common import ( +from deepmd.tf.common import ( clear_session, ) -from deepmd.entrypoints import ( +from deepmd.tf.entrypoints import ( compress, convert, doc_train_input, @@ -26,10 +26,10 @@ train_dp, transfer, ) -from deepmd.loggers import ( +from deepmd.tf.loggers import ( set_log_handles, ) -from deepmd.nvnmd.entrypoints.train import ( +from deepmd.tf.nvnmd.entrypoints.train import ( train_nvnmd, ) from deepmd_utils.main import ( diff --git a/deepmd/entrypoints/neighbor_stat.py b/deepmd/tf/entrypoints/neighbor_stat.py similarity index 92% rename from deepmd/entrypoints/neighbor_stat.py rename to deepmd/tf/entrypoints/neighbor_stat.py index 28cab00ad2..d2e8a01e82 100644 --- a/deepmd/entrypoints/neighbor_stat.py +++ b/deepmd/tf/entrypoints/neighbor_stat.py @@ -4,13 +4,13 @@ List, ) -from deepmd.common import ( +from deepmd.tf.common import ( expand_sys_str, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) -from deepmd.utils.neighbor_stat import ( +from deepmd.tf.utils.neighbor_stat import ( NeighborStat, ) diff --git a/deepmd/entrypoints/test.py b/deepmd/tf/entrypoints/test.py similarity index 99% rename from deepmd/entrypoints/test.py rename to deepmd/tf/entrypoints/test.py index 4658b16e7c..1b917bc276 100644 --- a/deepmd/entrypoints/test.py +++ b/deepmd/tf/entrypoints/test.py @@ -14,29 +14,29 @@ import numpy as np -from deepmd import ( +from deepmd.tf import ( DeepPotential, ) -from deepmd.common import ( +from deepmd.tf.common import ( expand_sys_str, ) -from deepmd.utils import random as dp_random -from deepmd.utils.data import ( +from deepmd.tf.utils import random as dp_random +from deepmd.tf.utils.data import ( DeepmdData, ) -from deepmd.utils.weight_avg import ( +from deepmd.tf.utils.weight_avg import ( weighted_average, ) if TYPE_CHECKING: - from deepmd.infer import ( + from deepmd.tf.infer import ( DeepDipole, DeepDOS, DeepPolar, DeepPot, DeepWFC, ) - from deepmd.infer.deep_tensor import ( + from deepmd.tf.infer.deep_tensor import ( DeepTensor, ) diff --git a/deepmd/entrypoints/train.py b/deepmd/tf/entrypoints/train.py similarity index 96% rename from deepmd/entrypoints/train.py rename to deepmd/tf/entrypoints/train.py index 227aa13644..17063d2bac 100755 --- a/deepmd/entrypoints/train.py +++ b/deepmd/tf/entrypoints/train.py @@ -13,52 +13,52 @@ Optional, ) -from deepmd.common import ( +from deepmd.tf.common import ( data_requirement, expand_sys_str, j_loader, j_must_have, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_ENER_FLOAT_PRECISION, reset_default_tf_session_config, tf, ) -from deepmd.infer.data_modifier import ( +from deepmd.tf.infer.data_modifier import ( DipoleChargeModifier, ) -from deepmd.model.model import ( +from deepmd.tf.model.model import ( Model, ) -from deepmd.train.run_options import ( +from deepmd.tf.train.run_options import ( BUILD, CITATION, WELCOME, RunOptions, ) -from deepmd.train.trainer import ( +from deepmd.tf.train.trainer import ( DPTrainer, ) -from deepmd.utils import random as dp_random -from deepmd.utils.argcheck import ( +from deepmd.tf.utils import random as dp_random +from deepmd.tf.utils.argcheck import ( normalize, ) -from deepmd.utils.compat import ( +from deepmd.tf.utils.compat import ( update_deepmd_input, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) -from deepmd.utils.finetune import ( +from deepmd.tf.utils.finetune import ( replace_model_params_with_pretrained_model, ) -from deepmd.utils.multi_init import ( +from deepmd.tf.utils.multi_init import ( replace_model_params_with_frz_multi_model, ) -from deepmd.utils.neighbor_stat import ( +from deepmd.tf.utils.neighbor_stat import ( NeighborStat, ) -from deepmd.utils.path import ( +from deepmd.tf.utils.path import ( DPPath, ) diff --git a/deepmd/entrypoints/transfer.py b/deepmd/tf/entrypoints/transfer.py similarity index 99% rename from deepmd/entrypoints/transfer.py rename to deepmd/tf/entrypoints/transfer.py index 535b32ec09..7c90c77de8 100644 --- a/deepmd/entrypoints/transfer.py +++ b/deepmd/tf/entrypoints/transfer.py @@ -11,7 +11,7 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( TRANSFER_PATTERN, tf, ) diff --git a/deepmd/env.py b/deepmd/tf/env.py similarity index 100% rename from deepmd/env.py rename to deepmd/tf/env.py diff --git a/deepmd/fit/__init__.py b/deepmd/tf/fit/__init__.py similarity index 100% rename from deepmd/fit/__init__.py rename to deepmd/tf/fit/__init__.py diff --git a/deepmd/fit/dipole.py b/deepmd/tf/fit/dipole.py similarity index 97% rename from deepmd/fit/dipole.py rename to deepmd/tf/fit/dipole.py index 312bcc9bf1..55da62d69b 100644 --- a/deepmd/fit/dipole.py +++ b/deepmd/tf/fit/dipole.py @@ -6,27 +6,27 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( cast_precision, get_activation_func, get_precision, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit.fitting import ( +from deepmd.tf.fit.fitting import ( Fitting, ) -from deepmd.loss.loss import ( +from deepmd.tf.loss.loss import ( Loss, ) -from deepmd.loss.tensor import ( +from deepmd.tf.loss.tensor import ( TensorLoss, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_fitting_net_variables_from_graph_def, ) -from deepmd.utils.network import ( +from deepmd.tf.utils.network import ( one_layer, one_layer_rand_seed_shift, ) diff --git a/deepmd/fit/dos.py b/deepmd/tf/fit/dos.py similarity index 98% rename from deepmd/fit/dos.py rename to deepmd/tf/fit/dos.py index bbf7d39a09..e8681f47ea 100644 --- a/deepmd/fit/dos.py +++ b/deepmd/tf/fit/dos.py @@ -7,40 +7,40 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( add_data_requirement, cast_precision, get_activation_func, get_precision, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, tf, ) -from deepmd.fit.fitting import ( +from deepmd.tf.fit.fitting import ( Fitting, ) -from deepmd.loss.dos import ( +from deepmd.tf.loss.dos import ( DOSLoss, ) -from deepmd.loss.loss import ( +from deepmd.tf.loss.loss import ( Loss, ) -from deepmd.nvnmd.fit.ener import ( +from deepmd.tf.nvnmd.fit.ener import ( one_layer_nvnmd, ) -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) -from deepmd.utils.errors import ( +from deepmd.tf.utils.errors import ( GraphWithoutTensorError, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_fitting_net_variables_from_graph_def, get_tensor_by_name_from_graph, ) -from deepmd.utils.network import one_layer as one_layer_deepmd -from deepmd.utils.network import ( +from deepmd.tf.utils.network import one_layer as one_layer_deepmd +from deepmd.tf.utils.network import ( one_layer_rand_seed_shift, ) diff --git a/deepmd/fit/ener.py b/deepmd/tf/fit/ener.py similarity index 98% rename from deepmd/fit/ener.py rename to deepmd/tf/fit/ener.py index 4c15e57124..751e5091bd 100644 --- a/deepmd/fit/ener.py +++ b/deepmd/tf/fit/ener.py @@ -7,49 +7,49 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( add_data_requirement, cast_precision, get_activation_func, get_precision, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, global_cvt_2_tf_float, tf, ) -from deepmd.fit.fitting import ( +from deepmd.tf.fit.fitting import ( Fitting, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPotential, ) -from deepmd.loss.ener import ( +from deepmd.tf.loss.ener import ( EnerDipoleLoss, EnerSpinLoss, EnerStdLoss, ) -from deepmd.loss.loss import ( +from deepmd.tf.loss.loss import ( Loss, ) -from deepmd.nvnmd.fit.ener import ( +from deepmd.tf.nvnmd.fit.ener import ( one_layer_nvnmd, ) -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) -from deepmd.utils.errors import ( +from deepmd.tf.utils.errors import ( GraphWithoutTensorError, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_fitting_net_variables_from_graph_def, get_tensor_by_name_from_graph, ) -from deepmd.utils.network import one_layer as one_layer_deepmd -from deepmd.utils.network import ( +from deepmd.tf.utils.network import one_layer as one_layer_deepmd +from deepmd.tf.utils.network import ( one_layer_rand_seed_shift, ) -from deepmd.utils.spin import ( +from deepmd.tf.utils.spin import ( Spin, ) diff --git a/deepmd/fit/fitting.py b/deepmd/tf/fit/fitting.py similarity index 96% rename from deepmd/fit/fitting.py rename to deepmd/tf/fit/fitting.py index a467ec1201..5d666a19f7 100644 --- a/deepmd/fit/fitting.py +++ b/deepmd/tf/fit/fitting.py @@ -6,13 +6,13 @@ Callable, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.loss.loss import ( +from deepmd.tf.loss.loss import ( Loss, ) -from deepmd.utils import ( +from deepmd.tf.utils import ( Plugin, PluginVariant, ) diff --git a/deepmd/fit/polar.py b/deepmd/tf/fit/polar.py similarity index 98% rename from deepmd/fit/polar.py rename to deepmd/tf/fit/polar.py index 8f6631866c..ae02c02064 100644 --- a/deepmd/fit/polar.py +++ b/deepmd/tf/fit/polar.py @@ -7,30 +7,30 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( cast_precision, get_activation_func, get_precision, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit.fitting import ( +from deepmd.tf.fit.fitting import ( Fitting, ) -from deepmd.loss.loss import ( +from deepmd.tf.loss.loss import ( Loss, ) -from deepmd.loss.tensor import ( +from deepmd.tf.loss.tensor import ( TensorLoss, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_fitting_net_variables_from_graph_def, ) -from deepmd.utils.network import ( +from deepmd.tf.utils.network import ( one_layer, one_layer_rand_seed_shift, ) diff --git a/deepmd/infer/__init__.py b/deepmd/tf/infer/__init__.py similarity index 100% rename from deepmd/infer/__init__.py rename to deepmd/tf/infer/__init__.py diff --git a/deepmd/infer/data_modifier.py b/deepmd/tf/infer/data_modifier.py similarity index 98% rename from deepmd/infer/data_modifier.py rename to deepmd/tf/infer/data_modifier.py index 62c4b879e9..e53151d80a 100644 --- a/deepmd/infer/data_modifier.py +++ b/deepmd/tf/infer/data_modifier.py @@ -7,26 +7,26 @@ import numpy as np -import deepmd.op # noqa: F401 -from deepmd.common import ( +import deepmd.tf.op # noqa: F401 +from deepmd.tf.common import ( make_default_mesh, select_idx_map, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, op_module, tf, ) -from deepmd.infer.deep_dipole import ( +from deepmd.tf.infer.deep_dipole import ( DeepDipole, ) -from deepmd.infer.ewald_recp import ( +from deepmd.tf.infer.ewald_recp import ( EwaldRecp, ) -from deepmd.utils.data import ( +from deepmd.tf.utils.data import ( DeepmdData, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) diff --git a/deepmd/infer/deep_dipole.py b/deepmd/tf/infer/deep_dipole.py similarity index 97% rename from deepmd/infer/deep_dipole.py rename to deepmd/tf/infer/deep_dipole.py index aba098a9f3..a0a4a0f78e 100644 --- a/deepmd/infer/deep_dipole.py +++ b/deepmd/tf/infer/deep_dipole.py @@ -4,7 +4,7 @@ Optional, ) -from deepmd.infer.deep_tensor import ( +from deepmd.tf.infer.deep_tensor import ( DeepTensor, ) diff --git a/deepmd/infer/deep_dos.py b/deepmd/tf/infer/deep_dos.py similarity index 99% rename from deepmd/infer/deep_dos.py rename to deepmd/tf/infer/deep_dos.py index 5f181bd336..9b2830161d 100644 --- a/deepmd/infer/deep_dos.py +++ b/deepmd/tf/infer/deep_dos.py @@ -11,16 +11,16 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( make_default_mesh, ) -from deepmd.infer.deep_eval import ( +from deepmd.tf.infer.deep_eval import ( DeepEval, ) -from deepmd.utils.batch_size import ( +from deepmd.tf.utils.batch_size import ( AutoBatchSize, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) diff --git a/deepmd/infer/deep_eval.py b/deepmd/tf/infer/deep_eval.py similarity index 98% rename from deepmd/infer/deep_eval.py rename to deepmd/tf/infer/deep_eval.py index 0ca9f21a77..9e3106f4ad 100644 --- a/deepmd/infer/deep_eval.py +++ b/deepmd/tf/infer/deep_eval.py @@ -11,15 +11,15 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( MODEL_VERSION, default_tf_session_config, tf, ) -from deepmd.utils.batch_size import ( +from deepmd.tf.utils.batch_size import ( AutoBatchSize, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) @@ -353,13 +353,13 @@ def eval_typeebd(self) -> np.ndarray: See Also -------- - deepmd.utils.type_embed.TypeEmbedNet : The type embedding network. + deepmd.tf.utils.type_embed.TypeEmbedNet : The type embedding network. Examples -------- Get the output of type embedding network of `graph.pb`: - >>> from deepmd.infer import DeepPotential + >>> from deepmd.tf.infer import DeepPotential >>> dp = DeepPotential('graph.pb') >>> dp.eval_typeebd() """ diff --git a/deepmd/infer/deep_polar.py b/deepmd/tf/infer/deep_polar.py similarity index 99% rename from deepmd/infer/deep_polar.py rename to deepmd/tf/infer/deep_polar.py index c1f981ef86..e0b73da2a2 100644 --- a/deepmd/infer/deep_polar.py +++ b/deepmd/tf/infer/deep_polar.py @@ -7,7 +7,7 @@ import numpy as np -from deepmd.infer.deep_tensor import ( +from deepmd.tf.infer.deep_tensor import ( DeepTensor, ) diff --git a/deepmd/infer/deep_pot.py b/deepmd/tf/infer/deep_pot.py similarity index 99% rename from deepmd/infer/deep_pot.py rename to deepmd/tf/infer/deep_pot.py index 45db3fcb0c..df1f8a477f 100644 --- a/deepmd/infer/deep_pot.py +++ b/deepmd/tf/infer/deep_pot.py @@ -11,19 +11,19 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( make_default_mesh, ) -from deepmd.infer.data_modifier import ( +from deepmd.tf.infer.data_modifier import ( DipoleChargeModifier, ) -from deepmd.infer.deep_eval import ( +from deepmd.tf.infer.deep_eval import ( DeepEval, ) -from deepmd.utils.batch_size import ( +from deepmd.tf.utils.batch_size import ( AutoBatchSize, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) from deepmd_utils.infer.deep_pot import DeepPot as DeepPotBase @@ -58,7 +58,7 @@ class DeepPot(DeepEval, DeepPotBase): Examples -------- - >>> from deepmd.infer import DeepPot + >>> from deepmd.tf.infer import DeepPot >>> import numpy as np >>> dp = DeepPot('graph.pb') >>> coord = np.array([[1,0,0], [0,0,1.5], [1,0,3]]).reshape([1, -1]) diff --git a/deepmd/infer/deep_tensor.py b/deepmd/tf/infer/deep_tensor.py similarity index 99% rename from deepmd/infer/deep_tensor.py rename to deepmd/tf/infer/deep_tensor.py index a803eb0c6b..9b064114b4 100644 --- a/deepmd/infer/deep_tensor.py +++ b/deepmd/tf/infer/deep_tensor.py @@ -10,13 +10,13 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( make_default_mesh, ) -from deepmd.infer.deep_eval import ( +from deepmd.tf.infer.deep_eval import ( DeepEval, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) diff --git a/deepmd/infer/deep_wfc.py b/deepmd/tf/infer/deep_wfc.py similarity index 97% rename from deepmd/infer/deep_wfc.py rename to deepmd/tf/infer/deep_wfc.py index ed682f642b..aa0dff6f38 100644 --- a/deepmd/infer/deep_wfc.py +++ b/deepmd/tf/infer/deep_wfc.py @@ -4,7 +4,7 @@ Optional, ) -from deepmd.infer.deep_tensor import ( +from deepmd.tf.infer.deep_tensor import ( DeepTensor, ) diff --git a/deepmd/infer/ewald_recp.py b/deepmd/tf/infer/ewald_recp.py similarity index 97% rename from deepmd/infer/ewald_recp.py rename to deepmd/tf/infer/ewald_recp.py index 429a3cdfd6..110188c34f 100644 --- a/deepmd/infer/ewald_recp.py +++ b/deepmd/tf/infer/ewald_recp.py @@ -5,13 +5,13 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, default_tf_session_config, op_module, tf, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) diff --git a/deepmd/infer/model_devi.py b/deepmd/tf/infer/model_devi.py similarity index 100% rename from deepmd/infer/model_devi.py rename to deepmd/tf/infer/model_devi.py diff --git a/deepmd/lmp.py b/deepmd/tf/lmp.py similarity index 99% rename from deepmd/lmp.py rename to deepmd/tf/lmp.py index 5238cd9935..f8497bef59 100644 --- a/deepmd/lmp.py +++ b/deepmd/tf/lmp.py @@ -17,7 +17,7 @@ Version, ) -from deepmd.env import ( +from deepmd.tf.env import ( SHARED_LIB_DIR, TF_VERSION, tf, diff --git a/deepmd/loggers/__init__.py b/deepmd/tf/loggers/__init__.py similarity index 100% rename from deepmd/loggers/__init__.py rename to deepmd/tf/loggers/__init__.py diff --git a/deepmd/loggers/loggers.py b/deepmd/tf/loggers/loggers.py similarity index 100% rename from deepmd/loggers/loggers.py rename to deepmd/tf/loggers/loggers.py diff --git a/deepmd/loss/__init__.py b/deepmd/tf/loss/__init__.py similarity index 100% rename from deepmd/loss/__init__.py rename to deepmd/tf/loss/__init__.py diff --git a/deepmd/loss/dos.py b/deepmd/tf/loss/dos.py similarity index 98% rename from deepmd/loss/dos.py rename to deepmd/tf/loss/dos.py index 7d38f2b17a..763e75638f 100644 --- a/deepmd/loss/dos.py +++ b/deepmd/tf/loss/dos.py @@ -1,15 +1,15 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( add_data_requirement, ) -from deepmd.env import ( +from deepmd.tf.env import ( global_cvt_2_ener_float, global_cvt_2_tf_float, tf, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) diff --git a/deepmd/loss/ener.py b/deepmd/tf/loss/ener.py similarity index 99% rename from deepmd/loss/ener.py rename to deepmd/tf/loss/ener.py index d7f83f09e5..48a13319e4 100644 --- a/deepmd/loss/ener.py +++ b/deepmd/tf/loss/ener.py @@ -5,15 +5,15 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( add_data_requirement, ) -from deepmd.env import ( +from deepmd.tf.env import ( global_cvt_2_ener_float, global_cvt_2_tf_float, tf, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) diff --git a/deepmd/loss/loss.py b/deepmd/tf/loss/loss.py similarity index 98% rename from deepmd/loss/loss.py rename to deepmd/tf/loss/loss.py index a719a08d81..327aea5230 100644 --- a/deepmd/loss/loss.py +++ b/deepmd/tf/loss/loss.py @@ -10,7 +10,7 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) diff --git a/deepmd/loss/tensor.py b/deepmd/tf/loss/tensor.py similarity index 98% rename from deepmd/loss/tensor.py rename to deepmd/tf/loss/tensor.py index a40f95a18e..3be01d3871 100644 --- a/deepmd/loss/tensor.py +++ b/deepmd/tf/loss/tensor.py @@ -1,14 +1,14 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( add_data_requirement, ) -from deepmd.env import ( +from deepmd.tf.env import ( global_cvt_2_tf_float, tf, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) diff --git a/deepmd/model/__init__.py b/deepmd/tf/model/__init__.py similarity index 100% rename from deepmd/model/__init__.py rename to deepmd/tf/model/__init__.py diff --git a/deepmd/model/dos.py b/deepmd/tf/model/dos.py similarity index 99% rename from deepmd/model/dos.py rename to deepmd/tf/model/dos.py index 22e291a0f0..265026b60a 100644 --- a/deepmd/model/dos.py +++ b/deepmd/tf/model/dos.py @@ -5,12 +5,12 @@ Union, ) -from deepmd.env import ( +from deepmd.tf.env import ( MODEL_VERSION, global_cvt_2_ener_float, tf, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) diff --git a/deepmd/model/ener.py b/deepmd/tf/model/ener.py similarity index 99% rename from deepmd/model/ener.py rename to deepmd/tf/model/ener.py index 0d8d66b305..70e0f4d2ba 100644 --- a/deepmd/model/ener.py +++ b/deepmd/tf/model/ener.py @@ -7,19 +7,19 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( MODEL_VERSION, global_cvt_2_ener_float, op_module, tf, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) -from deepmd.utils.spin import ( +from deepmd.tf.utils.spin import ( Spin, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) diff --git a/deepmd/model/frozen.py b/deepmd/tf/model/frozen.py similarity index 97% rename from deepmd/model/frozen.py rename to deepmd/tf/model/frozen.py index 38f342ebec..8732fec8f4 100644 --- a/deepmd/model/frozen.py +++ b/deepmd/tf/model/frozen.py @@ -7,18 +7,18 @@ Union, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, MODEL_VERSION, tf, ) -from deepmd.fit.fitting import ( +from deepmd.tf.fit.fitting import ( Fitting, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPotential, ) -from deepmd.loss.loss import ( +from deepmd.tf.loss.loss import ( Loss, ) diff --git a/deepmd/model/linear.py b/deepmd/tf/model/linear.py similarity index 98% rename from deepmd/model/linear.py rename to deepmd/tf/model/linear.py index 7c527fe9dc..7563e36b3f 100644 --- a/deepmd/model/linear.py +++ b/deepmd/tf/model/linear.py @@ -11,15 +11,15 @@ Union, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, MODEL_VERSION, tf, ) -from deepmd.fit.fitting import ( +from deepmd.tf.fit.fitting import ( Fitting, ) -from deepmd.loss.loss import ( +from deepmd.tf.loss.loss import ( Loss, ) diff --git a/deepmd/model/model.py b/deepmd/tf/model/model.py similarity index 97% rename from deepmd/model/model.py rename to deepmd/tf/model/model.py index 6117b4942d..eee138907f 100644 --- a/deepmd/model/model.py +++ b/deepmd/tf/model/model.py @@ -13,35 +13,35 @@ Union, ) -from deepmd.descriptor.descriptor import ( +from deepmd.tf.descriptor.descriptor import ( Descriptor, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, tf, ) -from deepmd.fit.fitting import ( +from deepmd.tf.fit.fitting import ( Fitting, ) -from deepmd.loss.loss import ( +from deepmd.tf.loss.loss import ( Loss, ) -from deepmd.utils.argcheck import ( +from deepmd.tf.utils.argcheck import ( type_embedding_args, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( load_graph_def, ) -from deepmd.utils.pair_tab import ( +from deepmd.tf.utils.pair_tab import ( PairTab, ) -from deepmd.utils.spin import ( +from deepmd.tf.utils.spin import ( Spin, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) @@ -88,19 +88,19 @@ def get_class_by_input(cls, input: dict): The input data """ # infer model type by fitting_type - from deepmd.model.frozen import ( + from deepmd.tf.model.frozen import ( FrozenModel, ) - from deepmd.model.linear import ( + from deepmd.tf.model.linear import ( LinearEnergyModel, ) - from deepmd.model.multi import ( + from deepmd.tf.model.multi import ( MultiModel, ) - from deepmd.model.pairtab import ( + from deepmd.tf.model.pairtab import ( PairTabModel, ) - from deepmd.model.pairwise_dprc import ( + from deepmd.tf.model.pairwise_dprc import ( PairwiseDPRc, ) @@ -515,7 +515,7 @@ def get_feed_dict( natoms[1]: total number of atoms held by this processor natoms[i]: 2 <= i < Ntypes+2, number of type i atoms box : tf.Tensor - The box. Can be generated by deepmd.model.make_stat_input + The box. Can be generated by deepmd.tf.model.make_stat_input mesh : tf.Tensor For historical reasons, only the length of the Tensor matters. if size of mesh == 6, pbc is assumed. diff --git a/deepmd/model/model_stat.py b/deepmd/tf/model/model_stat.py similarity index 100% rename from deepmd/model/model_stat.py rename to deepmd/tf/model/model_stat.py diff --git a/deepmd/model/multi.py b/deepmd/tf/model/multi.py similarity index 98% rename from deepmd/model/multi.py rename to deepmd/tf/model/multi.py index 83b231c0e8..52bbcebf4d 100644 --- a/deepmd/model/multi.py +++ b/deepmd/tf/model/multi.py @@ -8,41 +8,41 @@ import numpy as np -from deepmd.descriptor.descriptor import ( +from deepmd.tf.descriptor.descriptor import ( Descriptor, ) -from deepmd.env import ( +from deepmd.tf.env import ( MODEL_VERSION, global_cvt_2_ener_float, op_module, tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( DipoleFittingSeA, DOSFitting, EnerFitting, GlobalPolarFittingSeA, PolarFittingSeA, ) -from deepmd.fit.fitting import ( +from deepmd.tf.fit.fitting import ( Fitting, ) -from deepmd.loss.loss import ( +from deepmd.tf.loss.loss import ( Loss, ) -from deepmd.utils.argcheck import ( +from deepmd.tf.utils.argcheck import ( type_embedding_args, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_tensor_by_name_from_graph, ) -from deepmd.utils.pair_tab import ( +from deepmd.tf.utils.pair_tab import ( PairTab, ) -from deepmd.utils.spin import ( +from deepmd.tf.utils.spin import ( Spin, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) diff --git a/deepmd/model/pairtab.py b/deepmd/tf/model/pairtab.py similarity index 97% rename from deepmd/model/pairtab.py rename to deepmd/tf/model/pairtab.py index 38934818e6..fe94c43f64 100644 --- a/deepmd/model/pairtab.py +++ b/deepmd/tf/model/pairtab.py @@ -10,23 +10,23 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, MODEL_VERSION, global_cvt_2_ener_float, op_module, tf, ) -from deepmd.fit.fitting import ( +from deepmd.tf.fit.fitting import ( Fitting, ) -from deepmd.loss.loss import ( +from deepmd.tf.loss.loss import ( Loss, ) -from deepmd.model.model import ( +from deepmd.tf.model.model import ( Model, ) -from deepmd.utils.pair_tab import ( +from deepmd.tf.utils.pair_tab import ( PairTab, ) @@ -280,7 +280,7 @@ def update_sel(cls, global_jdata: dict, local_jdata: dict) -> dict: dict The updated local data """ - from deepmd.entrypoints.train import ( + from deepmd.tf.entrypoints.train import ( update_one_sel, ) diff --git a/deepmd/model/pairwise_dprc.py b/deepmd/tf/model/pairwise_dprc.py similarity index 97% rename from deepmd/model/pairwise_dprc.py rename to deepmd/tf/model/pairwise_dprc.py index f74571febb..51296a0df9 100644 --- a/deepmd/model/pairwise_dprc.py +++ b/deepmd/tf/model/pairwise_dprc.py @@ -6,29 +6,29 @@ Union, ) -from deepmd.common import ( +from deepmd.tf.common import ( add_data_requirement, make_default_mesh, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, MODEL_VERSION, op_module, tf, ) -from deepmd.loss.loss import ( +from deepmd.tf.loss.loss import ( Loss, ) -from deepmd.model.model import ( +from deepmd.tf.model.model import ( Model, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( load_graph_def, ) -from deepmd.utils.spin import ( +from deepmd.tf.utils.spin import ( Spin, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) @@ -377,7 +377,7 @@ def get_feed_dict( natoms[1]: total number of atoms held by this processor natoms[i]: 2 <= i < Ntypes+2, number of type i atoms box : tf.Tensor - The box. Can be generated by deepmd.model.make_stat_input + The box. Can be generated by deepmd.tf.model.make_stat_input mesh : tf.Tensor For historical reasons, only the length of the Tensor matters. if size of mesh == 6, pbc is assumed. @@ -412,7 +412,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 ( get_min_nbor_dist, ) diff --git a/deepmd/model/tensor.py b/deepmd/tf/model/tensor.py similarity index 99% rename from deepmd/model/tensor.py rename to deepmd/tf/model/tensor.py index 6a21e085f3..9c851b6eb0 100644 --- a/deepmd/model/tensor.py +++ b/deepmd/tf/model/tensor.py @@ -5,11 +5,11 @@ Union, ) -from deepmd.env import ( +from deepmd.tf.env import ( MODEL_VERSION, tf, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) diff --git a/deepmd/nvnmd/__init__.py b/deepmd/tf/nvnmd/__init__.py similarity index 100% rename from deepmd/nvnmd/__init__.py rename to deepmd/tf/nvnmd/__init__.py diff --git a/deepmd/nvnmd/data/__init__.py b/deepmd/tf/nvnmd/data/__init__.py similarity index 100% rename from deepmd/nvnmd/data/__init__.py rename to deepmd/tf/nvnmd/data/__init__.py diff --git a/deepmd/nvnmd/data/data.py b/deepmd/tf/nvnmd/data/data.py similarity index 100% rename from deepmd/nvnmd/data/data.py rename to deepmd/tf/nvnmd/data/data.py diff --git a/deepmd/nvnmd/descriptor/__init__.py b/deepmd/tf/nvnmd/descriptor/__init__.py similarity index 100% rename from deepmd/nvnmd/descriptor/__init__.py rename to deepmd/tf/nvnmd/descriptor/__init__.py diff --git a/deepmd/nvnmd/descriptor/se_a.py b/deepmd/tf/nvnmd/descriptor/se_a.py similarity index 98% rename from deepmd/nvnmd/descriptor/se_a.py rename to deepmd/tf/nvnmd/descriptor/se_a.py index 816f17cfa3..cc90df7a5c 100644 --- a/deepmd/nvnmd/descriptor/se_a.py +++ b/deepmd/tf/nvnmd/descriptor/se_a.py @@ -3,7 +3,7 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, GLOBAL_TF_FLOAT_PRECISION, op_module, @@ -11,16 +11,16 @@ ) # -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) -from deepmd.nvnmd.utils.weight import ( +from deepmd.tf.nvnmd.utils.weight import ( get_normalize, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_tensor_by_name_from_graph, ) -from deepmd.utils.network import ( +from deepmd.tf.utils.network import ( embedding_net, ) diff --git a/deepmd/nvnmd/descriptor/se_atten.py b/deepmd/tf/nvnmd/descriptor/se_atten.py similarity index 98% rename from deepmd/nvnmd/descriptor/se_atten.py rename to deepmd/tf/nvnmd/descriptor/se_atten.py index cfffb8a90b..474f6995cf 100644 --- a/deepmd/nvnmd/descriptor/se_atten.py +++ b/deepmd/tf/nvnmd/descriptor/se_atten.py @@ -3,20 +3,20 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, op_module, tf, ) # -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) -from deepmd.nvnmd.utils.weight import ( +from deepmd.tf.nvnmd.utils.weight import ( get_normalize, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_tensor_by_name_from_graph, ) diff --git a/deepmd/nvnmd/entrypoints/__init__.py b/deepmd/tf/nvnmd/entrypoints/__init__.py similarity index 100% rename from deepmd/nvnmd/entrypoints/__init__.py rename to deepmd/tf/nvnmd/entrypoints/__init__.py diff --git a/deepmd/nvnmd/entrypoints/freeze.py b/deepmd/tf/nvnmd/entrypoints/freeze.py similarity index 96% rename from deepmd/nvnmd/entrypoints/freeze.py rename to deepmd/tf/nvnmd/entrypoints/freeze.py index e56a0c2130..2a2b8d9179 100644 --- a/deepmd/nvnmd/entrypoints/freeze.py +++ b/deepmd/tf/nvnmd/entrypoints/freeze.py @@ -1,13 +1,13 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: LGPL-3.0-or-later -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.nvnmd.utils.fio import ( +from deepmd.tf.nvnmd.utils.fio import ( FioDic, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_tensor_by_name_from_graph, ) diff --git a/deepmd/nvnmd/entrypoints/mapt.py b/deepmd/tf/nvnmd/entrypoints/mapt.py similarity index 98% rename from deepmd/nvnmd/entrypoints/mapt.py rename to deepmd/tf/nvnmd/entrypoints/mapt.py index 1299d7a74e..7401234e35 100644 --- a/deepmd/nvnmd/entrypoints/mapt.py +++ b/deepmd/tf/nvnmd/entrypoints/mapt.py @@ -6,30 +6,30 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( op_module, tf, ) -from deepmd.nvnmd.data.data import ( +from deepmd.tf.nvnmd.data.data import ( jdata_deepmd_input_v0, jdata_sys, ) -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) -from deepmd.nvnmd.utils.fio import ( +from deepmd.tf.nvnmd.utils.fio import ( FioDic, ) -from deepmd.nvnmd.utils.network import ( +from deepmd.tf.nvnmd.utils.network import ( get_sess, ) -from deepmd.nvnmd.utils.weight import ( +from deepmd.tf.nvnmd.utils.weight import ( get_filter_type_weight, get_filter_weight, get_normalize, get_type_embedding_weight, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) diff --git a/deepmd/nvnmd/entrypoints/train.py b/deepmd/tf/nvnmd/entrypoints/train.py similarity index 94% rename from deepmd/nvnmd/entrypoints/train.py rename to deepmd/tf/nvnmd/entrypoints/train.py index 6e14b6f865..18c644a7f6 100644 --- a/deepmd/nvnmd/entrypoints/train.py +++ b/deepmd/tf/nvnmd/entrypoints/train.py @@ -5,28 +5,28 @@ Optional, ) -from deepmd.entrypoints.freeze import ( +from deepmd.tf.entrypoints.freeze import ( freeze, ) -from deepmd.entrypoints.train import ( +from deepmd.tf.entrypoints.train import ( train, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.nvnmd.data.data import ( +from deepmd.tf.nvnmd.data.data import ( jdata_deepmd_input_v0, ) -from deepmd.nvnmd.entrypoints.mapt import ( +from deepmd.tf.nvnmd.entrypoints.mapt import ( mapt, ) -from deepmd.nvnmd.entrypoints.wrap import ( +from deepmd.tf.nvnmd.entrypoints.wrap import ( wrap, ) -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) -from deepmd.nvnmd.utils.fio import ( +from deepmd.tf.nvnmd.utils.fio import ( FioDic, ) diff --git a/deepmd/nvnmd/entrypoints/wrap.py b/deepmd/tf/nvnmd/entrypoints/wrap.py similarity index 98% rename from deepmd/nvnmd/entrypoints/wrap.py rename to deepmd/tf/nvnmd/entrypoints/wrap.py index 1ba2ed7384..f2be8352e2 100644 --- a/deepmd/nvnmd/entrypoints/wrap.py +++ b/deepmd/tf/nvnmd/entrypoints/wrap.py @@ -6,32 +6,32 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( op_module, tf, ) -from deepmd.nvnmd.data.data import ( +from deepmd.tf.nvnmd.data.data import ( jdata_deepmd_input_v0, jdata_sys, ) -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) -from deepmd.nvnmd.utils.encode import ( +from deepmd.tf.nvnmd.utils.encode import ( Encode, ) -from deepmd.nvnmd.utils.fio import ( +from deepmd.tf.nvnmd.utils.fio import ( FioBin, FioTxt, ) -from deepmd.nvnmd.utils.network import ( +from deepmd.tf.nvnmd.utils.network import ( get_sess, ) -from deepmd.nvnmd.utils.weight import ( +from deepmd.tf.nvnmd.utils.weight import ( get_fitnet_weight, get_type_weight, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) diff --git a/deepmd/nvnmd/fit/__init__.py b/deepmd/tf/nvnmd/fit/__init__.py similarity index 100% rename from deepmd/nvnmd/fit/__init__.py rename to deepmd/tf/nvnmd/fit/__init__.py diff --git a/deepmd/nvnmd/fit/ener.py b/deepmd/tf/nvnmd/fit/ener.py similarity index 58% rename from deepmd/nvnmd/fit/ener.py rename to deepmd/tf/nvnmd/fit/ener.py index 1f316a2145..20adda395c 100644 --- a/deepmd/nvnmd/fit/ener.py +++ b/deepmd/tf/nvnmd/fit/ener.py @@ -1,12 +1,12 @@ # SPDX-License-Identifier: LGPL-3.0-or-later -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, tf, ) -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) -from deepmd.nvnmd.utils.network import one_layer as one_layer_nvnmd +from deepmd.tf.nvnmd.utils.network import one_layer as one_layer_nvnmd __all__ = [ "GLOBAL_TF_FLOAT_PRECISION", diff --git a/deepmd/nvnmd/utils/__init__.py b/deepmd/tf/nvnmd/utils/__init__.py similarity index 100% rename from deepmd/nvnmd/utils/__init__.py rename to deepmd/tf/nvnmd/utils/__init__.py diff --git a/deepmd/nvnmd/utils/argcheck.py b/deepmd/tf/nvnmd/utils/argcheck.py similarity index 100% rename from deepmd/nvnmd/utils/argcheck.py rename to deepmd/tf/nvnmd/utils/argcheck.py diff --git a/deepmd/nvnmd/utils/config.py b/deepmd/tf/nvnmd/utils/config.py similarity index 99% rename from deepmd/nvnmd/utils/config.py rename to deepmd/tf/nvnmd/utils/config.py index 5bfd9ea54f..15998069b3 100644 --- a/deepmd/nvnmd/utils/config.py +++ b/deepmd/tf/nvnmd/utils/config.py @@ -3,7 +3,7 @@ import numpy as np -from deepmd.nvnmd.data.data import ( +from deepmd.tf.nvnmd.data.data import ( NVNMD_CITATION, NVNMD_WELCOME, jdata_config_v0, @@ -17,10 +17,10 @@ jdata_deepmd_input_v1_ni128, jdata_deepmd_input_v1_ni256, ) -from deepmd.nvnmd.utils.fio import ( +from deepmd.tf.nvnmd.utils.fio import ( FioDic, ) -from deepmd.nvnmd.utils.op import ( +from deepmd.tf.nvnmd.utils.op import ( r2s, ) diff --git a/deepmd/nvnmd/utils/encode.py b/deepmd/tf/nvnmd/utils/encode.py similarity index 99% rename from deepmd/nvnmd/utils/encode.py rename to deepmd/tf/nvnmd/utils/encode.py index 55f4efd52e..21398fbf23 100644 --- a/deepmd/nvnmd/utils/encode.py +++ b/deepmd/tf/nvnmd/utils/encode.py @@ -3,7 +3,7 @@ import numpy as np -from deepmd.nvnmd.data.data import ( +from deepmd.tf.nvnmd.data.data import ( jdata_sys, ) diff --git a/deepmd/nvnmd/utils/fio.py b/deepmd/tf/nvnmd/utils/fio.py similarity index 100% rename from deepmd/nvnmd/utils/fio.py rename to deepmd/tf/nvnmd/utils/fio.py diff --git a/deepmd/nvnmd/utils/network.py b/deepmd/tf/nvnmd/utils/network.py similarity index 98% rename from deepmd/nvnmd/utils/network.py rename to deepmd/tf/nvnmd/utils/network.py index f0c357eabe..76c80ed4e7 100644 --- a/deepmd/nvnmd/utils/network.py +++ b/deepmd/tf/nvnmd/utils/network.py @@ -3,18 +3,18 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, op_module, tf, ) -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) -from deepmd.nvnmd.utils.weight import ( +from deepmd.tf.nvnmd.utils.weight import ( get_constant_initializer, ) -from deepmd.utils.network import ( +from deepmd.tf.utils.network import ( variable_summaries, ) diff --git a/deepmd/nvnmd/utils/op.py b/deepmd/tf/nvnmd/utils/op.py similarity index 100% rename from deepmd/nvnmd/utils/op.py rename to deepmd/tf/nvnmd/utils/op.py diff --git a/deepmd/nvnmd/utils/weight.py b/deepmd/tf/nvnmd/utils/weight.py similarity index 98% rename from deepmd/nvnmd/utils/weight.py rename to deepmd/tf/nvnmd/utils/weight.py index cc5ab15219..7a60712455 100644 --- a/deepmd/nvnmd/utils/weight.py +++ b/deepmd/tf/nvnmd/utils/weight.py @@ -1,10 +1,10 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import logging -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) diff --git a/deepmd/op/__init__.py b/deepmd/tf/op/__init__.py similarity index 96% rename from deepmd/op/__init__.py rename to deepmd/tf/op/__init__.py index 9cdfec70cc..421ef0b123 100644 --- a/deepmd/op/__init__.py +++ b/deepmd/tf/op/__init__.py @@ -8,7 +8,7 @@ ) NOT_LOADABLE = ("__init__.py",) -PACKAGE_BASE = "deepmd.op" +PACKAGE_BASE = "deepmd.tf.op" log = logging.getLogger(__name__) diff --git a/deepmd/op/_add_flt_nvnmd_grad.py b/deepmd/tf/op/_add_flt_nvnmd_grad.py similarity index 90% rename from deepmd/op/_add_flt_nvnmd_grad.py rename to deepmd/tf/op/_add_flt_nvnmd_grad.py index 105ec1ec6d..3bea39fcec 100644 --- a/deepmd/op/_add_flt_nvnmd_grad.py +++ b/deepmd/tf/op/_add_flt_nvnmd_grad.py @@ -5,7 +5,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_module, ) diff --git a/deepmd/op/_copy_flt_nvnmd_grad.py b/deepmd/tf/op/_copy_flt_nvnmd_grad.py similarity index 91% rename from deepmd/op/_copy_flt_nvnmd_grad.py rename to deepmd/tf/op/_copy_flt_nvnmd_grad.py index 09c4a72324..401acba22c 100644 --- a/deepmd/op/_copy_flt_nvnmd_grad.py +++ b/deepmd/tf/op/_copy_flt_nvnmd_grad.py @@ -5,7 +5,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_module, ) diff --git a/deepmd/op/_dotmul_flt_nvnmd_grad.py b/deepmd/tf/op/_dotmul_flt_nvnmd_grad.py similarity index 95% rename from deepmd/op/_dotmul_flt_nvnmd_grad.py rename to deepmd/tf/op/_dotmul_flt_nvnmd_grad.py index 0f786a6d38..8a4ffb2d0c 100644 --- a/deepmd/op/_dotmul_flt_nvnmd_grad.py +++ b/deepmd/tf/op/_dotmul_flt_nvnmd_grad.py @@ -5,7 +5,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_module, tf, ) diff --git a/deepmd/op/_flt_nvnmd_grad.py b/deepmd/tf/op/_flt_nvnmd_grad.py similarity index 90% rename from deepmd/op/_flt_nvnmd_grad.py rename to deepmd/tf/op/_flt_nvnmd_grad.py index 0dd67c2c57..b0fbaea11d 100644 --- a/deepmd/op/_flt_nvnmd_grad.py +++ b/deepmd/tf/op/_flt_nvnmd_grad.py @@ -5,7 +5,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_module, ) diff --git a/deepmd/op/_gelu.py b/deepmd/tf/op/_gelu.py similarity index 97% rename from deepmd/op/_gelu.py rename to deepmd/tf/op/_gelu.py index 6768ac10b3..fcfd2d49fa 100644 --- a/deepmd/op/_gelu.py +++ b/deepmd/tf/op/_gelu.py @@ -6,7 +6,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_module, ) diff --git a/deepmd/op/_map_flt_nvnmd_grad.py b/deepmd/tf/op/_map_flt_nvnmd_grad.py similarity index 97% rename from deepmd/op/_map_flt_nvnmd_grad.py rename to deepmd/tf/op/_map_flt_nvnmd_grad.py index 3e5749e74c..46f258cafe 100644 --- a/deepmd/op/_map_flt_nvnmd_grad.py +++ b/deepmd/tf/op/_map_flt_nvnmd_grad.py @@ -5,7 +5,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_module, tf, ) diff --git a/deepmd/op/_matmul_fitnet_nvnmd_grad.py b/deepmd/tf/op/_matmul_fitnet_nvnmd_grad.py similarity index 94% rename from deepmd/op/_matmul_fitnet_nvnmd_grad.py rename to deepmd/tf/op/_matmul_fitnet_nvnmd_grad.py index bab3905c5a..f8d566bd39 100644 --- a/deepmd/op/_matmul_fitnet_nvnmd_grad.py +++ b/deepmd/tf/op/_matmul_fitnet_nvnmd_grad.py @@ -5,7 +5,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_module, tf, ) diff --git a/deepmd/op/_matmul_flt2fix_nvnmd.py b/deepmd/tf/op/_matmul_flt2fix_nvnmd.py similarity index 97% rename from deepmd/op/_matmul_flt2fix_nvnmd.py rename to deepmd/tf/op/_matmul_flt2fix_nvnmd.py index db9af761de..319fb90ec8 100644 --- a/deepmd/op/_matmul_flt2fix_nvnmd.py +++ b/deepmd/tf/op/_matmul_flt2fix_nvnmd.py @@ -5,7 +5,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_module, tf, ) diff --git a/deepmd/op/_matmul_flt_nvnmd_grad.py b/deepmd/tf/op/_matmul_flt_nvnmd_grad.py similarity index 97% rename from deepmd/op/_matmul_flt_nvnmd_grad.py rename to deepmd/tf/op/_matmul_flt_nvnmd_grad.py index 1e3ed74c91..6493794b00 100644 --- a/deepmd/op/_matmul_flt_nvnmd_grad.py +++ b/deepmd/tf/op/_matmul_flt_nvnmd_grad.py @@ -5,7 +5,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_module, tf, ) diff --git a/deepmd/op/_mul_flt_nvnmd_grad.py b/deepmd/tf/op/_mul_flt_nvnmd_grad.py similarity index 96% rename from deepmd/op/_mul_flt_nvnmd_grad.py rename to deepmd/tf/op/_mul_flt_nvnmd_grad.py index c50baf8c12..d05daa7dfa 100644 --- a/deepmd/op/_mul_flt_nvnmd_grad.py +++ b/deepmd/tf/op/_mul_flt_nvnmd_grad.py @@ -5,7 +5,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_module, tf, ) diff --git a/deepmd/op/_prod_force_grad.py b/deepmd/tf/op/_prod_force_grad.py similarity index 95% rename from deepmd/op/_prod_force_grad.py rename to deepmd/tf/op/_prod_force_grad.py index ffa34a8126..449901c137 100644 --- a/deepmd/op/_prod_force_grad.py +++ b/deepmd/tf/op/_prod_force_grad.py @@ -6,7 +6,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_grads_module, ) diff --git a/deepmd/op/_prod_force_se_a_grad.py b/deepmd/tf/op/_prod_force_se_a_grad.py similarity index 95% rename from deepmd/op/_prod_force_se_a_grad.py rename to deepmd/tf/op/_prod_force_se_a_grad.py index b58b819ee1..d732803bad 100644 --- a/deepmd/op/_prod_force_se_a_grad.py +++ b/deepmd/tf/op/_prod_force_se_a_grad.py @@ -6,7 +6,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_grads_module, ) diff --git a/deepmd/op/_prod_force_se_a_mask_grad.py b/deepmd/tf/op/_prod_force_se_a_mask_grad.py similarity index 95% rename from deepmd/op/_prod_force_se_a_mask_grad.py rename to deepmd/tf/op/_prod_force_se_a_mask_grad.py index d5ef829da2..a7f2d72b16 100644 --- a/deepmd/op/_prod_force_se_a_mask_grad.py +++ b/deepmd/tf/op/_prod_force_se_a_mask_grad.py @@ -6,7 +6,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_grads_module, ) diff --git a/deepmd/op/_prod_force_se_r_grad.py b/deepmd/tf/op/_prod_force_se_r_grad.py similarity index 93% rename from deepmd/op/_prod_force_se_r_grad.py rename to deepmd/tf/op/_prod_force_se_r_grad.py index 254e2e331a..4ec65b31f2 100644 --- a/deepmd/op/_prod_force_se_r_grad.py +++ b/deepmd/tf/op/_prod_force_se_r_grad.py @@ -6,7 +6,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_grads_module, ) diff --git a/deepmd/op/_prod_virial_grad.py b/deepmd/tf/op/_prod_virial_grad.py similarity index 95% rename from deepmd/op/_prod_virial_grad.py rename to deepmd/tf/op/_prod_virial_grad.py index 4a946f3ba8..7fe245ed6b 100644 --- a/deepmd/op/_prod_virial_grad.py +++ b/deepmd/tf/op/_prod_virial_grad.py @@ -6,7 +6,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_grads_module, ) diff --git a/deepmd/op/_prod_virial_se_a_grad.py b/deepmd/tf/op/_prod_virial_se_a_grad.py similarity index 95% rename from deepmd/op/_prod_virial_se_a_grad.py rename to deepmd/tf/op/_prod_virial_se_a_grad.py index 0e738f86b3..c95d3b58e2 100644 --- a/deepmd/op/_prod_virial_se_a_grad.py +++ b/deepmd/tf/op/_prod_virial_se_a_grad.py @@ -6,7 +6,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_grads_module, ) diff --git a/deepmd/op/_prod_virial_se_r_grad.py b/deepmd/tf/op/_prod_virial_se_r_grad.py similarity index 94% rename from deepmd/op/_prod_virial_se_r_grad.py rename to deepmd/tf/op/_prod_virial_se_r_grad.py index a943b35670..8f51310c8c 100644 --- a/deepmd/op/_prod_virial_se_r_grad.py +++ b/deepmd/tf/op/_prod_virial_se_r_grad.py @@ -6,7 +6,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_grads_module, ) diff --git a/deepmd/op/_quantize_nvnmd_grad.py b/deepmd/tf/op/_quantize_nvnmd_grad.py similarity index 93% rename from deepmd/op/_quantize_nvnmd_grad.py rename to deepmd/tf/op/_quantize_nvnmd_grad.py index 2ef282fa78..f1d99dc18d 100644 --- a/deepmd/op/_quantize_nvnmd_grad.py +++ b/deepmd/tf/op/_quantize_nvnmd_grad.py @@ -5,7 +5,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_module, ) diff --git a/deepmd/op/_soft_min_force_grad.py b/deepmd/tf/op/_soft_min_force_grad.py similarity index 95% rename from deepmd/op/_soft_min_force_grad.py rename to deepmd/tf/op/_soft_min_force_grad.py index ae9cf882c8..cd18f3e186 100644 --- a/deepmd/op/_soft_min_force_grad.py +++ b/deepmd/tf/op/_soft_min_force_grad.py @@ -6,7 +6,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_grads_module, ) diff --git a/deepmd/op/_soft_min_virial_grad.py b/deepmd/tf/op/_soft_min_virial_grad.py similarity index 95% rename from deepmd/op/_soft_min_virial_grad.py rename to deepmd/tf/op/_soft_min_virial_grad.py index 56b828b12c..4d4f4790dd 100644 --- a/deepmd/op/_soft_min_virial_grad.py +++ b/deepmd/tf/op/_soft_min_virial_grad.py @@ -6,7 +6,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_grads_module, ) diff --git a/deepmd/op/_tabulate_grad.py b/deepmd/tf/op/_tabulate_grad.py similarity index 97% rename from deepmd/op/_tabulate_grad.py rename to deepmd/tf/op/_tabulate_grad.py index 8ad8908d7e..667981ef9f 100644 --- a/deepmd/op/_tabulate_grad.py +++ b/deepmd/tf/op/_tabulate_grad.py @@ -6,11 +6,11 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_module, ) -# from deepmd.DescrptSeATabulate import last_layer_size +# from deepmd.tf.DescrptSeATabulate import last_layer_size @ops.RegisterGradient("TabulateFusion") diff --git a/deepmd/op/_tanh4_flt_nvnmd_grad.py b/deepmd/tf/op/_tanh4_flt_nvnmd_grad.py similarity index 97% rename from deepmd/op/_tanh4_flt_nvnmd_grad.py rename to deepmd/tf/op/_tanh4_flt_nvnmd_grad.py index 45d7366545..04d1724d0b 100644 --- a/deepmd/op/_tanh4_flt_nvnmd_grad.py +++ b/deepmd/tf/op/_tanh4_flt_nvnmd_grad.py @@ -5,7 +5,7 @@ ops, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) diff --git a/deepmd/train/__init__.py b/deepmd/tf/train/__init__.py similarity index 100% rename from deepmd/train/__init__.py rename to deepmd/tf/train/__init__.py diff --git a/deepmd/train/run_options.py b/deepmd/tf/train/run_options.py similarity index 98% rename from deepmd/train/run_options.py rename to deepmd/tf/train/run_options.py index 451632949e..fb9d8beecb 100644 --- a/deepmd/train/run_options.py +++ b/deepmd/tf/train/run_options.py @@ -16,17 +16,17 @@ Version, ) -from deepmd.cluster import ( +from deepmd.tf.cluster import ( get_resource, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_CONFIG, TF_VERSION, get_tf_default_nthreads, global_float_prec, tf, ) -from deepmd.loggers import ( +from deepmd.tf.loggers import ( set_log_handles, ) diff --git a/deepmd/train/trainer.py b/deepmd/tf/train/trainer.py similarity index 99% rename from deepmd/train/trainer.py rename to deepmd/tf/train/trainer.py index 3b81740a93..19b81d7a13 100644 --- a/deepmd/train/trainer.py +++ b/deepmd/tf/train/trainer.py @@ -21,13 +21,13 @@ ) # load grad of force module -import deepmd.op # noqa: F401 -from deepmd.common import ( +import deepmd.tf.op # noqa: F401 +from deepmd.tf.common import ( data_requirement, get_precision, j_must_have, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_ENER_FLOAT_PRECISION, GLOBAL_TF_FLOAT_PRECISION, TF_VERSION, @@ -35,38 +35,38 @@ tf, tfv2, ) -from deepmd.fit.ener import ( +from deepmd.tf.fit.ener import ( EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( MultiModel, ) -from deepmd.model.model import ( +from deepmd.tf.model.model import ( Model, ) -from deepmd.utils import random as dp_random -from deepmd.utils.data_system import ( +from deepmd.tf.utils import random as dp_random +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) -from deepmd.utils.errors import ( +from deepmd.tf.utils.errors import ( GraphTooLargeError, GraphWithoutTensorError, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_tensor_by_name_from_graph, load_graph_def, ) -from deepmd.utils.learning_rate import ( +from deepmd.tf.utils.learning_rate import ( LearningRateExp, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) log = logging.getLogger(__name__) # nvnmd -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) diff --git a/deepmd/utils/__init__.py b/deepmd/tf/utils/__init__.py similarity index 100% rename from deepmd/utils/__init__.py rename to deepmd/tf/utils/__init__.py diff --git a/deepmd/utils/argcheck.py b/deepmd/tf/utils/argcheck.py similarity index 100% rename from deepmd/utils/argcheck.py rename to deepmd/tf/utils/argcheck.py diff --git a/deepmd/utils/batch_size.py b/deepmd/tf/utils/batch_size.py similarity index 94% rename from deepmd/utils/batch_size.py rename to deepmd/tf/utils/batch_size.py index 863520b3f4..50d02a887b 100644 --- a/deepmd/utils/batch_size.py +++ b/deepmd/tf/utils/batch_size.py @@ -3,11 +3,11 @@ Version, ) -from deepmd.env import ( +from deepmd.tf.env import ( TF_VERSION, tf, ) -from deepmd.utils.errors import ( +from deepmd.tf.utils.errors import ( OutOfMemoryError, ) from deepmd_utils.utils.batch_size import AutoBatchSize as AutoBatchSizeBase diff --git a/deepmd/utils/compat.py b/deepmd/tf/utils/compat.py similarity index 100% rename from deepmd/utils/compat.py rename to deepmd/tf/utils/compat.py diff --git a/deepmd/utils/compress.py b/deepmd/tf/utils/compress.py similarity index 98% rename from deepmd/utils/compress.py rename to deepmd/tf/utils/compress.py index 7a79dec520..0bce633573 100644 --- a/deepmd/utils/compress.py +++ b/deepmd/tf/utils/compress.py @@ -3,10 +3,10 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_pattern_nodes_from_graph_def, get_tensor_by_name_from_graph, ) diff --git a/deepmd/utils/convert.py b/deepmd/tf/utils/convert.py similarity index 99% rename from deepmd/utils/convert.py rename to deepmd/tf/utils/convert.py index 13e07f0885..625f54a9a0 100644 --- a/deepmd/utils/convert.py +++ b/deepmd/tf/utils/convert.py @@ -14,10 +14,10 @@ ) from packaging.version import parse as parse_version -from deepmd import ( +from deepmd.tf import ( __version__, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) diff --git a/deepmd/utils/data.py b/deepmd/tf/utils/data.py similarity index 100% rename from deepmd/utils/data.py rename to deepmd/tf/utils/data.py diff --git a/deepmd/utils/data_system.py b/deepmd/tf/utils/data_system.py similarity index 100% rename from deepmd/utils/data_system.py rename to deepmd/tf/utils/data_system.py diff --git a/deepmd/utils/errors.py b/deepmd/tf/utils/errors.py similarity index 100% rename from deepmd/utils/errors.py rename to deepmd/tf/utils/errors.py diff --git a/deepmd/utils/finetune.py b/deepmd/tf/utils/finetune.py similarity index 98% rename from deepmd/utils/finetune.py rename to deepmd/tf/utils/finetune.py index cc6c0224de..01b5eaaafe 100644 --- a/deepmd/utils/finetune.py +++ b/deepmd/tf/utils/finetune.py @@ -6,10 +6,10 @@ Dict, ) -from deepmd.utils.errors import ( +from deepmd.tf.utils.errors import ( GraphWithoutTensorError, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_tensor_by_name, ) diff --git a/deepmd/utils/graph.py b/deepmd/tf/utils/graph.py similarity index 99% rename from deepmd/utils/graph.py rename to deepmd/tf/utils/graph.py index ad4ee0224a..9d2608e34a 100644 --- a/deepmd/utils/graph.py +++ b/deepmd/tf/utils/graph.py @@ -7,17 +7,17 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( ATTENTION_LAYER_PATTERN, EMBEDDING_NET_PATTERN, FITTING_NET_PATTERN, TYPE_EMBEDDING_PATTERN, tf, ) -from deepmd.utils.errors import ( +from deepmd.tf.utils.errors import ( GraphWithoutTensorError, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) diff --git a/deepmd/utils/learning_rate.py b/deepmd/tf/utils/learning_rate.py similarity index 99% rename from deepmd/utils/learning_rate.py rename to deepmd/tf/utils/learning_rate.py index 5bec5120cd..519bf20bd0 100644 --- a/deepmd/utils/learning_rate.py +++ b/deepmd/tf/utils/learning_rate.py @@ -5,7 +5,7 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) diff --git a/deepmd/utils/multi_init.py b/deepmd/tf/utils/multi_init.py similarity index 98% rename from deepmd/utils/multi_init.py rename to deepmd/tf/utils/multi_init.py index 6c070dc67e..056a6694e8 100644 --- a/deepmd/utils/multi_init.py +++ b/deepmd/tf/utils/multi_init.py @@ -6,10 +6,10 @@ Dict, ) -from deepmd.utils.errors import ( +from deepmd.tf.utils.errors import ( GraphWithoutTensorError, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_tensor_by_name, ) diff --git a/deepmd/utils/neighbor_stat.py b/deepmd/tf/utils/neighbor_stat.py similarity index 98% rename from deepmd/utils/neighbor_stat.py rename to deepmd/tf/utils/neighbor_stat.py index fa9325937e..a240b515db 100644 --- a/deepmd/utils/neighbor_stat.py +++ b/deepmd/tf/utils/neighbor_stat.py @@ -8,16 +8,16 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, default_tf_session_config, op_module, tf, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) -from deepmd.utils.parallel_op import ( +from deepmd.tf.utils.parallel_op import ( ParallelOp, ) diff --git a/deepmd/utils/network.py b/deepmd/tf/utils/network.py similarity index 99% rename from deepmd/utils/network.py rename to deepmd/tf/utils/network.py index 36d8c42f82..fb8e89c737 100644 --- a/deepmd/utils/network.py +++ b/deepmd/tf/utils/network.py @@ -1,10 +1,10 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( get_precision, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, tf, ) diff --git a/deepmd/utils/pair_tab.py b/deepmd/tf/utils/pair_tab.py similarity index 100% rename from deepmd/utils/pair_tab.py rename to deepmd/tf/utils/pair_tab.py diff --git a/deepmd/utils/parallel_op.py b/deepmd/tf/utils/parallel_op.py similarity index 94% rename from deepmd/utils/parallel_op.py rename to deepmd/tf/utils/parallel_op.py index 9ef68bbd84..b7590ed720 100644 --- a/deepmd/utils/parallel_op.py +++ b/deepmd/tf/utils/parallel_op.py @@ -8,10 +8,10 @@ Tuple, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) @@ -30,8 +30,8 @@ class ParallelOp: Examples -------- - >>> from deepmd.env import tf - >>> from deepmd.utils.parallel_op import ParallelOp + >>> from deepmd.tf.env import tf + >>> from deepmd.tf.utils.parallel_op import ParallelOp >>> def builder(): ... x = tf.placeholder(tf.int32, [1]) ... return {"x": x}, (x + 1) diff --git a/deepmd/utils/path.py b/deepmd/tf/utils/path.py similarity index 100% rename from deepmd/utils/path.py rename to deepmd/tf/utils/path.py diff --git a/deepmd/utils/plugin.py b/deepmd/tf/utils/plugin.py similarity index 100% rename from deepmd/utils/plugin.py rename to deepmd/tf/utils/plugin.py diff --git a/deepmd/utils/random.py b/deepmd/tf/utils/random.py similarity index 100% rename from deepmd/utils/random.py rename to deepmd/tf/utils/random.py diff --git a/deepmd/utils/sess.py b/deepmd/tf/utils/sess.py similarity index 95% rename from deepmd/utils/sess.py rename to deepmd/tf/utils/sess.py index a87adffd91..ca98980f89 100644 --- a/deepmd/utils/sess.py +++ b/deepmd/tf/utils/sess.py @@ -1,10 +1,10 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import os -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.utils.errors import ( +from deepmd.tf.utils.errors import ( OutOfMemoryError, ) diff --git a/deepmd/utils/spin.py b/deepmd/tf/utils/spin.py similarity index 98% rename from deepmd/utils/spin.py rename to deepmd/tf/utils/spin.py index 7820627649..c20d4dcc7b 100644 --- a/deepmd/utils/spin.py +++ b/deepmd/tf/utils/spin.py @@ -4,7 +4,7 @@ Optional, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, tf, ) diff --git a/deepmd/utils/tabulate.py b/deepmd/tf/utils/tabulate.py similarity index 92% rename from deepmd/utils/tabulate.py rename to deepmd/tf/utils/tabulate.py index 2b270b1dbc..4ade5962e0 100644 --- a/deepmd/utils/tabulate.py +++ b/deepmd/tf/utils/tabulate.py @@ -16,17 +16,17 @@ ) import deepmd -from deepmd.common import ( +from deepmd.tf.common import ( ACTIVATION_FN_DICT, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( Descriptor, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_module, tf, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_embedding_net_nodes_from_graph_def, get_tensor_by_name_from_graph, ) @@ -107,15 +107,15 @@ def __init__( self.sub_graph, self.sub_graph_def = self._load_sub_graph() self.sub_sess = tf.Session(graph=self.sub_graph) - if isinstance(self.descrpt, deepmd.descriptor.DescrptSeR): + if isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeR): self.sel_a = self.descrpt.sel_r self.rcut = self.descrpt.rcut self.rcut_smth = self.descrpt.rcut_smth - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeA): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeA): self.sel_a = self.descrpt.sel_a self.rcut = self.descrpt.rcut_r self.rcut_smth = self.descrpt.rcut_r_smth - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeT): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeT): self.sel_a = self.descrpt.sel_a self.rcut = self.descrpt.rcut_r self.rcut_smth = self.descrpt.rcut_r_smth @@ -179,8 +179,8 @@ def build( """ # tabulate range [lower, upper] with stride0 'stride0' lower, upper = self._get_env_mat_range(min_nbor_dist) - if isinstance(self.descrpt, deepmd.descriptor.DescrptSeAtten) or isinstance( - self.descrpt, deepmd.descriptor.DescrptSeAEbdV2 + if isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeAtten) or isinstance( + self.descrpt, deepmd.tf.descriptor.DescrptSeAEbdV2 ): uu = np.max(upper) ll = np.min(lower) @@ -196,7 +196,7 @@ def build( self._build_lower( "filter_net", xx, 0, uu, ll, stride0, stride1, extrapolate, nspline ) - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeA): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeA): for ii in range(self.table_size): if (self.type_one_side and not self._all_excluded(ii)) or ( not self.type_one_side @@ -233,7 +233,7 @@ def build( self._build_lower( net, xx, ii, uu, ll, stride0, stride1, extrapolate, nspline ) - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeT): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeT): xx_all = [] for ii in range(self.ntypes): xx = np.arange( @@ -275,7 +275,7 @@ def build( nspline[ii], ) idx += 1 - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeR): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeR): for ii in range(self.table_size): if (self.type_one_side and not self._all_excluded(ii)) or ( not self.type_one_side @@ -327,10 +327,10 @@ def _build_lower( ) # tt.shape: [nspline, self.last_layer_size] - if isinstance(self.descrpt, deepmd.descriptor.DescrptSeA): + if isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeA): tt = np.full((nspline, self.last_layer_size), stride1) tt[: int((upper - lower) / stride0), :] = stride0 - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeT): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeT): tt = np.full((nspline, self.last_layer_size), stride1) tt[ int((lower - extrapolate * lower) / stride1) + 1 : ( @@ -339,7 +339,7 @@ def _build_lower( ), :, ] = stride0 - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeR): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeR): tt = np.full((nspline, self.last_layer_size), stride1) tt[: int((upper - lower) / stride0), :] = stride0 else: @@ -423,14 +423,14 @@ def _get_bias(self): bias = {} for layer in range(1, self.layer_size + 1): bias["layer_" + str(layer)] = [] - if isinstance(self.descrpt, deepmd.descriptor.DescrptSeAtten) or isinstance( - self.descrpt, deepmd.descriptor.DescrptSeAEbdV2 - ): + if isinstance( + self.descrpt, deepmd.tf.descriptor.DescrptSeAtten + ) or isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeAEbdV2): node = self.embedding_net_nodes[ f"filter_type_all{self.suffix}/bias_{layer}" ] bias["layer_" + str(layer)].append(tf.make_ndarray(node)) - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeA): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeA): if self.type_one_side: for ii in range(0, self.ntypes): if not self._all_excluded(ii): @@ -452,14 +452,14 @@ def _get_bias(self): bias["layer_" + str(layer)].append(tf.make_ndarray(node)) else: bias["layer_" + str(layer)].append(np.array([])) - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeT): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeT): for ii in range(self.ntypes): for jj in range(ii, self.ntypes): node = self.embedding_net_nodes[ f"filter_type_all{self.suffix}/bias_{layer}_{ii}_{jj}" ] bias["layer_" + str(layer)].append(tf.make_ndarray(node)) - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeR): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeR): if self.type_one_side: for ii in range(0, self.ntypes): if not self._all_excluded(ii): @@ -489,14 +489,14 @@ def _get_matrix(self): matrix = {} for layer in range(1, self.layer_size + 1): matrix["layer_" + str(layer)] = [] - if isinstance(self.descrpt, deepmd.descriptor.DescrptSeAtten) or isinstance( - self.descrpt, deepmd.descriptor.DescrptSeAEbdV2 - ): + if isinstance( + self.descrpt, deepmd.tf.descriptor.DescrptSeAtten + ) or isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeAEbdV2): node = self.embedding_net_nodes[ f"filter_type_all{self.suffix}/matrix_{layer}" ] matrix["layer_" + str(layer)].append(tf.make_ndarray(node)) - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeA): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeA): if self.type_one_side: for ii in range(0, self.ntypes): if not self._all_excluded(ii): @@ -518,14 +518,14 @@ def _get_matrix(self): matrix["layer_" + str(layer)].append(tf.make_ndarray(node)) else: matrix["layer_" + str(layer)].append(np.array([])) - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeT): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeT): for ii in range(self.ntypes): for jj in range(ii, self.ntypes): node = self.embedding_net_nodes[ f"filter_type_all{self.suffix}/matrix_{layer}_{ii}_{jj}" ] matrix["layer_" + str(layer)].append(tf.make_ndarray(node)) - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeR): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeR): if self.type_one_side: for ii in range(0, self.ntypes): if not self._all_excluded(ii): @@ -712,14 +712,14 @@ def _layer_1(self, x, w, b): # Change the embedding net range to sw / min_nbor_dist def _get_env_mat_range(self, min_nbor_dist): sw = self._spline5_switch(min_nbor_dist, self.rcut_smth, self.rcut) - if isinstance(self.descrpt, deepmd.descriptor.DescrptSeA): + if isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeA): lower = -self.davg[:, 0] / self.dstd[:, 0] upper = ((1 / min_nbor_dist) * sw - self.davg[:, 0]) / self.dstd[:, 0] - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeT): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeT): var = np.square(sw / (min_nbor_dist * self.dstd[:, 1:4])) lower = np.min(-var, axis=1) upper = np.max(var, axis=1) - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeR): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeR): lower = -self.davg[:, 0] / self.dstd[:, 0] upper = ((1 / min_nbor_dist) * sw - self.davg[:, 0]) / self.dstd[:, 0] else: @@ -741,11 +741,11 @@ def _spline5_switch(self, xx, rmin, rmax): def _get_layer_size(self): layer_size = 0 - if isinstance(self.descrpt, deepmd.descriptor.DescrptSeAtten) or isinstance( - self.descrpt, deepmd.descriptor.DescrptSeAEbdV2 + if isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeAtten) or isinstance( + self.descrpt, deepmd.tf.descriptor.DescrptSeAEbdV2 ): layer_size = len(self.embedding_net_nodes) // 2 - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeA): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeA): layer_size = len(self.embedding_net_nodes) // ( (self.ntypes * self.ntypes - len(self.exclude_types)) * 2 ) @@ -753,11 +753,11 @@ def _get_layer_size(self): layer_size = len(self.embedding_net_nodes) // ( (self.ntypes - self._n_all_excluded) * 2 ) - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeT): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeT): layer_size = len(self.embedding_net_nodes) // int( comb(self.ntypes + 1, 2) * 2 ) - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeR): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeR): layer_size = len(self.embedding_net_nodes) // ( (self.ntypes * self.ntypes - len(self.exclude_types)) * 2 ) @@ -793,17 +793,17 @@ def _all_excluded(self, ii: int) -> bool: def _get_table_size(self): table_size = 0 - if isinstance(self.descrpt, deepmd.descriptor.DescrptSeAtten) or isinstance( - self.descrpt, deepmd.descriptor.DescrptSeAEbdV2 + if isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeAtten) or isinstance( + self.descrpt, deepmd.tf.descriptor.DescrptSeAEbdV2 ): table_size = 1 - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeA): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeA): table_size = self.ntypes * self.ntypes if self.type_one_side: table_size = self.ntypes - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeT): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeT): table_size = int(comb(self.ntypes + 1, 2)) - elif isinstance(self.descrpt, deepmd.descriptor.DescrptSeR): + elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeR): table_size = self.ntypes * self.ntypes if self.type_one_side: table_size = self.ntypes diff --git a/deepmd/utils/type_embed.py b/deepmd/tf/utils/type_embed.py similarity index 97% rename from deepmd/utils/type_embed.py rename to deepmd/tf/utils/type_embed.py index c8ab01f7f5..1cd20814d7 100644 --- a/deepmd/utils/type_embed.py +++ b/deepmd/tf/utils/type_embed.py @@ -5,20 +5,20 @@ Union, ) -from deepmd.common import ( +from deepmd.tf.common import ( get_activation_func, get_precision, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_type_embedding_net_variables_from_graph_def, ) -from deepmd.utils.network import ( +from deepmd.tf.utils.network import ( embedding_net, ) diff --git a/deepmd/utils/weight_avg.py b/deepmd/tf/utils/weight_avg.py similarity index 100% rename from deepmd/utils/weight_avg.py rename to deepmd/tf/utils/weight_avg.py diff --git a/deepmd_utils/calculator.py b/deepmd_utils/calculator.py index 5b45aa49b3..65022d3ccc 100644 --- a/deepmd_utils/calculator.py +++ b/deepmd_utils/calculator.py @@ -53,7 +53,7 @@ class DP(Calculator): Compute potential energy >>> from ase import Atoms - >>> from deepmd.calculator import DP + >>> from deepmd.tf.calculator import DP >>> water = Atoms('H2O', >>> positions=[(0.7601, 1.9270, 1), >>> (1.9575, 1, 1), diff --git a/deepmd_utils/infer/deep_pot.py b/deepmd_utils/infer/deep_pot.py index 66510ea349..cc328356d3 100644 --- a/deepmd_utils/infer/deep_pot.py +++ b/deepmd_utils/infer/deep_pot.py @@ -52,7 +52,7 @@ def __new__(cls, model_file: str, *args, **kwargs): if cls is DeepPot: backend = detect_backend(model_file) if backend == DPBackend.TensorFlow: - from deepmd.infer.deep_pot import DeepPot as DeepPotTF + from deepmd.tf.infer.deep_pot import DeepPot as DeepPotTF return super().__new__(DeepPotTF) elif backend == DPBackend.PyTorch: diff --git a/deepmd_utils/infer/model_devi.py b/deepmd_utils/infer/model_devi.py index b0693f5823..cf303e2245 100644 --- a/deepmd_utils/infer/model_devi.py +++ b/deepmd_utils/infer/model_devi.py @@ -293,8 +293,8 @@ def calc_model_devi( Examples -------- - >>> from deepmd.infer import calc_model_devi - >>> from deepmd.infer import DeepPot as DP + >>> from deepmd.tf.infer import calc_model_devi + >>> from deepmd.tf.infer import DeepPot as DP >>> import numpy as np >>> coord = np.array([[1,0,0], [0,0,1.5], [1,0,3]]).reshape([1, -1]) >>> cell = np.diag(10 * np.ones(3)).reshape([1, -1]) diff --git a/deepmd_utils/main.py b/deepmd_utils/main.py index 19afaeee1f..32c43e17ac 100644 --- a/deepmd_utils/main.py +++ b/deepmd_utils/main.py @@ -651,6 +651,6 @@ def main(): if no command was input """ args = parse_args() - from deepmd.entrypoints.main import main as deepmd_main + from deepmd.tf.entrypoints.main import main as deepmd_main deepmd_main(args) diff --git a/deepmd_utils/model_format/se_e2_a.py b/deepmd_utils/model_format/se_e2_a.py index b9143ee360..37a2deb967 100644 --- a/deepmd_utils/model_format/se_e2_a.py +++ b/deepmd_utils/model_format/se_e2_a.py @@ -65,7 +65,7 @@ class DescrptSeA(NativeOP): :math:`\mathcal{G}^i_< \in \mathbb{R}^{N \times M_2}` takes first :math:`M_2` columns of :math:`\mathcal{G}^i`. The equation of embedding network :math:`\mathcal{N}` can be found at - :meth:`deepmd.utils.network.embedding_net`. + :meth:`deepmd.tf.utils.network.embedding_net`. Parameters ---------- diff --git a/deepmd_utils/utils/argcheck.py b/deepmd_utils/utils/argcheck.py index 6c51a7b859..aaaf8973ab 100644 --- a/deepmd_utils/utils/argcheck.py +++ b/deepmd_utils/utils/argcheck.py @@ -14,7 +14,7 @@ dargs, ) -from deepmd.common import ( +from deepmd.tf.common import ( ACTIVATION_FN_DICT, PRECISION_DICT, ) diff --git a/deepmd_utils/utils/compat.py b/deepmd_utils/utils/compat.py index 5f9c14e6d8..3c48da27c6 100644 --- a/deepmd_utils/utils/compat.py +++ b/deepmd_utils/utils/compat.py @@ -16,7 +16,7 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) diff --git a/doc/api_op.rst b/doc/api_op.rst index 9f4c650497..d620ec6ef5 100644 --- a/doc/api_op.rst +++ b/doc/api_op.rst @@ -4,7 +4,7 @@ OP API op_module --------- -.. automodule:: deepmd.env.op_module +.. automodule:: deepmd.tf.env.op_module :members: :imported-members: :show-inheritance: @@ -13,7 +13,7 @@ op_module op_grads_module --------------- -.. automodule:: deepmd.env.op_grads_module +.. automodule:: deepmd.tf.env.op_grads_module :members: :imported-members: :show-inheritance: diff --git a/doc/cli.rst b/doc/cli.rst index 668a2df2e3..15891369e3 100644 --- a/doc/cli.rst +++ b/doc/cli.rst @@ -4,6 +4,6 @@ Command line interface ====================== .. argparse:: - :module: deepmd.entrypoints.main + :module: deepmd.tf.entrypoints.main :func: main_parser :prog: dp diff --git a/doc/conf.py b/doc/conf.py index e6bb4b6ba2..8138f82ba4 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -17,11 +17,11 @@ date, ) -from deepmd.common import ( +from deepmd.tf.common import ( ACTIVATION_FN_DICT, PRECISION_DICT, ) -from deepmd.utils.argcheck import ( +from deepmd.tf.utils.argcheck import ( list_to_doc, ) diff --git a/doc/development/create-a-model.md b/doc/development/create-a-model.md index 6634403021..d71a6e519a 100644 --- a/doc/development/create-a-model.md +++ b/doc/development/create-a-model.md @@ -10,11 +10,11 @@ To incorporate your custom model you'll need to: ## Design a new component -When creating a new component, take descriptor as the example, you should inherit {py:class}`deepmd.descriptor.descriptor.Descriptor` class and override several methods. Abstract methods such as {py:class}`deepmd.descriptor.descriptor.Descriptor.build` must be implemented and others are not. You should keep arguments of these methods unchanged. +When creating a new component, take descriptor as the example, you should inherit {py:class}`deepmd.tf.descriptor.descriptor.Descriptor` class and override several methods. Abstract methods such as {py:class}`deepmd.tf.descriptor.descriptor.Descriptor.build` must be implemented and others are not. You should keep arguments of these methods unchanged. After implementation, you need to register the component with a key: ```py -from deepmd.descriptor import Descriptor +from deepmd.tf.descriptor import Descriptor @Descriptor.register("some_descrpt") @@ -31,7 +31,7 @@ To let someone uses your new component in their input file, you need to create a from typing import List from dargs import Argument -from deepmd.utils.argcheck import descrpt_args_plugin +from deepmd.tf.utils.argcheck import descrpt_args_plugin @descrpt_args_plugin.register("some_descrpt") diff --git a/doc/getting-started/quick_start.ipynb b/doc/getting-started/quick_start.ipynb index ec939265fd..d0f7d8db0b 100644 --- a/doc/getting-started/quick_start.ipynb +++ b/doc/getting-started/quick_start.ipynb @@ -1001,7 +1001,7 @@ "WARNING:tensorflow:From /opt/mamba/lib/python3.10/site-packages/deepmd/utils/batch_size.py:61: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.\n", "Instructions for updating:\n", "Use `tf.config.list_physical_devices('GPU')` instead.\n", - "WARNING:deepmd.utils.batch_size:You can use the environment variable DP_INFER_BATCH_SIZE tocontrol the inference batch size (nframes * natoms). The default value is 1024.\n" + "WARNING:deepmd.tf.utils.batch_size:You can use the environment variable DP_INFER_BATCH_SIZE tocontrol the inference batch size (nframes * natoms). The default value is 1024.\n" ] } ], diff --git a/doc/train/train-input.rst b/doc/train/train-input.rst index 2a32aeb930..04e82451e4 100644 --- a/doc/train/train-input.rst +++ b/doc/train/train-input.rst @@ -4,5 +4,5 @@ Training Parameters One can load, modify, and export the input file by using our effective web-based tool `DP-GUI `_ online or hosted using the :ref:`command line interface ` :code:`dp gui`. All training parameters below can be set in DP-GUI. By clicking "SAVE JSON", one can download the input file for furthur training. .. dargs:: - :module: deepmd.utils.argcheck + :module: deepmd.tf.utils.argcheck :func: gen_args diff --git a/pyproject.toml b/pyproject.toml index e5515984fb..46632c8ca5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ requires-python = ">=3.7" keywords = ["deepmd"] [project.entry-points."lammps.plugins"] -deepmd = "deepmd.lmp:get_op_dir" +deepmd = "deepmd.tf.lmp:get_op_dir" [project.entry-points."dpgui"] "DeePMD-kit" = "deepmd_utils.utils.argcheck:gen_args" @@ -128,7 +128,7 @@ replacement = '\1="https://github.com/deepmodeling/deepmd-kit/raw/master/\g<2>"' [tool.cibuildwheel] test-command = [ - "python -m deepmd -h", + "python -m deepmd.tf -h", "dp -h", "dp_ipi", "pytest {project}/source/tests/test_lammps.py" @@ -171,7 +171,7 @@ before-all = [ environment = { PIP_PREFER_BINARY="1" } test-extras = ["cpu"] test-command = [ - "python -m deepmd -h", + "python -m deepmd.tf -h", "dp -h", ] diff --git a/source/install/docker/Dockerfile b/source/install/docker/Dockerfile index 26b7be9f19..78a53cb895 100644 --- a/source/install/docker/Dockerfile +++ b/source/install/docker/Dockerfile @@ -10,7 +10,7 @@ RUN pip install "$(ls /dist/deepmd_kit${VARIANT}-*manylinux*_x86_64.whl)[gpu,cu$ && dp -h \ && lmp -h \ && dp_ipi \ - && python -m deepmd -h + && python -m deepmd.tf -h FROM python:3.11 AS build-image COPY --from=compile-image /opt/deepmd-kit /opt/deepmd-kit diff --git a/source/ipi/tests/test_driver.py b/source/ipi/tests/test_driver.py index 9ab6ff53de..78edeac977 100644 --- a/source/ipi/tests/test_driver.py +++ b/source/ipi/tests/test_driver.py @@ -18,7 +18,7 @@ SocketIOCalculator, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/lmp/tests/test_deeptensor.py b/source/lmp/tests/test_deeptensor.py index 3e684b386e..4fcf693482 100644 --- a/source/lmp/tests/test_deeptensor.py +++ b/source/lmp/tests/test_deeptensor.py @@ -57,7 +57,7 @@ sp.check_output( - "{} -m deepmd convert-from pbtxt -i {} -o {}".format( + "{} -m deepmd.tf convert-from pbtxt -i {} -o {}".format( sys.executable, pbtxt_file.resolve(), pb_file.resolve(), @@ -65,7 +65,7 @@ ) sp.check_output( - "{} -m deepmd convert-from pbtxt -i {} -o {}".format( + "{} -m deepmd.tf convert-from pbtxt -i {} -o {}".format( sys.executable, pbtxt_file2.resolve(), pb_file2.resolve(), diff --git a/source/lmp/tests/test_dplr.py b/source/lmp/tests/test_dplr.py index 9c8f1c0d4f..ac0acad68f 100644 --- a/source/lmp/tests/test_dplr.py +++ b/source/lmp/tests/test_dplr.py @@ -264,7 +264,7 @@ sp.check_output( - "{} -m deepmd convert-from pbtxt -i {} -o {}".format( + "{} -m deepmd.tf convert-from pbtxt -i {} -o {}".format( sys.executable, pbtxt_file.resolve(), pb_file.resolve(), diff --git a/source/lmp/tests/test_lammps.py b/source/lmp/tests/test_lammps.py index 028b403abf..7c7172bcb6 100644 --- a/source/lmp/tests/test_lammps.py +++ b/source/lmp/tests/test_lammps.py @@ -219,14 +219,14 @@ sp.check_output( - "{} -m deepmd convert-from pbtxt -i {} -o {}".format( + "{} -m deepmd.tf convert-from pbtxt -i {} -o {}".format( sys.executable, pbtxt_file.resolve(), pb_file.resolve(), ).split() ) sp.check_output( - "{} -m deepmd convert-from pbtxt -i {} -o {}".format( + "{} -m deepmd.tf convert-from pbtxt -i {} -o {}".format( sys.executable, pbtxt_file2.resolve(), pb_file2.resolve(), diff --git a/source/lmp/tests/test_lammps_3types.py b/source/lmp/tests/test_lammps_3types.py index 46e1a00c8f..72d3ca2e2e 100644 --- a/source/lmp/tests/test_lammps_3types.py +++ b/source/lmp/tests/test_lammps_3types.py @@ -245,14 +245,14 @@ nktv2p = 1.6021765e6 sp.check_output( - "{} -m deepmd convert-from pbtxt -i {} -o {}".format( + "{} -m deepmd.tf convert-from pbtxt -i {} -o {}".format( sys.executable, pbtxt_file.resolve(), pb_file.resolve(), ).split() ) sp.check_output( - "{} -m deepmd convert-from pbtxt -i {} -o {}".format( + "{} -m deepmd.tf convert-from pbtxt -i {} -o {}".format( sys.executable, pbtxt_file2.resolve(), pb_file2.resolve(), diff --git a/source/lmp/tests/test_lammps_faparam.py b/source/lmp/tests/test_lammps_faparam.py index 064928eeb1..8a6d0e01ef 100644 --- a/source/lmp/tests/test_lammps_faparam.py +++ b/source/lmp/tests/test_lammps_faparam.py @@ -134,7 +134,7 @@ sp.check_output( - "{} -m deepmd convert-from pbtxt -i {} -o {}".format( + "{} -m deepmd.tf convert-from pbtxt -i {} -o {}".format( sys.executable, pbtxt_file.resolve(), pb_file.resolve(), diff --git a/source/tests/common.py b/source/tests/common.py index 9af324896f..cb68e4d46d 100644 --- a/source/tests/common.py +++ b/source/tests/common.py @@ -8,15 +8,15 @@ import dpdata import numpy as np -from deepmd.common import j_loader as dp_j_loader -from deepmd.entrypoints.main import ( +from deepmd.tf.common import j_loader as dp_j_loader +from deepmd.tf.entrypoints.main import ( main, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, tf, ) -from deepmd.utils import random as dp_random +from deepmd.tf.utils import random as dp_random if GLOBAL_NP_FLOAT_PRECISION == np.float32: global_default_fv_hh = 1e-2 diff --git a/source/tests/test_activation_fn_gelu.py b/source/tests/test_activation_fn_gelu.py index b1c30eeefc..9be0885b74 100644 --- a/source/tests/test_activation_fn_gelu.py +++ b/source/tests/test_activation_fn_gelu.py @@ -3,13 +3,13 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( get_activation_func, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.utils.network import ( +from deepmd.tf.utils.network import ( embedding_net, ) diff --git a/source/tests/test_adjust_sel.py b/source/tests/test_adjust_sel.py index 0ff6eb0792..b1cbdc5afc 100644 --- a/source/tests/test_adjust_sel.py +++ b/source/tests/test_adjust_sel.py @@ -6,17 +6,17 @@ import numpy as np -# from deepmd.entrypoints.compress import compress +# from deepmd.tf.entrypoints.compress import compress from common import ( j_loader, run_dp, tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPot, ) diff --git a/source/tests/test_argument_parser.py b/source/tests/test_argument_parser.py index bb8dd9ed62..988199d1e4 100644 --- a/source/tests/test_argument_parser.py +++ b/source/tests/test_argument_parser.py @@ -21,7 +21,7 @@ Union, ) -from deepmd.entrypoints.main import ( +from deepmd.tf.entrypoints.main import ( get_ll, parse_args, ) diff --git a/source/tests/test_auto_batch_size.py b/source/tests/test_auto_batch_size.py index 5a349f70b9..3316e186b6 100644 --- a/source/tests/test_auto_batch_size.py +++ b/source/tests/test_auto_batch_size.py @@ -4,10 +4,10 @@ import numpy as np -from deepmd.utils.batch_size import ( +from deepmd.tf.utils.batch_size import ( AutoBatchSize, ) -from deepmd.utils.errors import ( +from deepmd.tf.utils.errors import ( OutOfMemoryError, ) diff --git a/source/tests/test_cluster.py b/source/tests/test_cluster.py index c946177cb5..27526a3ccf 100644 --- a/source/tests/test_cluster.py +++ b/source/tests/test_cluster.py @@ -4,7 +4,7 @@ mock, ) -from deepmd.cluster import ( +from deepmd.tf.cluster import ( local, slurm, ) diff --git a/source/tests/test_common.py b/source/tests/test_common.py index bf68e7056b..95948f29bb 100644 --- a/source/tests/test_common.py +++ b/source/tests/test_common.py @@ -5,12 +5,12 @@ Path, ) -from deepmd.common import ( +from deepmd.tf.common import ( GLOBAL_TF_FLOAT_PRECISION, cast_precision, expand_sys_str, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) @@ -66,7 +66,7 @@ def test_expand(self): class TestCastPrecision(unittest.TestCase): - """This class tests `deepmd.common.cast_precision`.""" + """This class tests `deepmd.tf.common.cast_precision`.""" @property def precision(self): diff --git a/source/tests/test_compat_input.py b/source/tests/test_compat_input.py index 97172be9e7..e8a74e9c48 100644 --- a/source/tests/test_compat_input.py +++ b/source/tests/test_compat_input.py @@ -6,7 +6,7 @@ j_loader, ) -from deepmd.utils.compat import ( +from deepmd.tf.utils.compat import ( convert_input_v0_v1, convert_input_v1_v2, ) diff --git a/source/tests/test_compressed_training.py b/source/tests/test_compressed_training.py index 0a0bbeaadf..c3d07762f8 100644 --- a/source/tests/test_compressed_training.py +++ b/source/tests/test_compressed_training.py @@ -3,7 +3,7 @@ import os import unittest -# from deepmd.entrypoints.compress import compress +# from deepmd.tf.entrypoints.compress import compress from common import ( j_loader, run_dp, @@ -11,7 +11,7 @@ ) from packaging.version import parse as parse_version -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) diff --git a/source/tests/test_data_large_batch.py b/source/tests/test_data_large_batch.py index 5750f956f8..84e99591d5 100644 --- a/source/tests/test_data_large_batch.py +++ b/source/tests/test_data_large_batch.py @@ -9,25 +9,25 @@ ) from packaging.version import parse as parse_version -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeAtten, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( EnerModel, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) diff --git a/source/tests/test_data_modifier.py b/source/tests/test_data_modifier.py index 368a60d68a..01e3cdcb2d 100644 --- a/source/tests/test_data_modifier.py +++ b/source/tests/test_data_modifier.py @@ -8,24 +8,24 @@ tests_path, ) -from deepmd.common import ( +from deepmd.tf.common import ( data_requirement, j_must_have, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, tf, ) -from deepmd.infer.data_modifier import ( +from deepmd.tf.infer.data_modifier import ( DipoleChargeModifier, ) -from deepmd.train.run_options import ( +from deepmd.tf.train.run_options import ( RunOptions, ) -from deepmd.train.trainer import ( +from deepmd.tf.train.trainer import ( DPTrainer, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) diff --git a/source/tests/test_data_modifier_shuffle.py b/source/tests/test_data_modifier_shuffle.py index 9ddbb8ee29..e6985b9e0f 100644 --- a/source/tests/test_data_modifier_shuffle.py +++ b/source/tests/test_data_modifier_shuffle.py @@ -4,27 +4,27 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( data_requirement, j_must_have, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, tf, ) -from deepmd.infer.data_modifier import ( +from deepmd.tf.infer.data_modifier import ( DipoleChargeModifier, ) -from deepmd.infer.deep_dipole import ( +from deepmd.tf.infer.deep_dipole import ( DeepDipole, ) -from deepmd.train.run_options import ( +from deepmd.tf.train.run_options import ( RunOptions, ) -from deepmd.train.trainer import ( +from deepmd.tf.train.trainer import ( DPTrainer, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) diff --git a/source/tests/test_data_requirement.py b/source/tests/test_data_requirement.py index 956cee8ccb..cabea15de1 100644 --- a/source/tests/test_data_requirement.py +++ b/source/tests/test_data_requirement.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import unittest -from deepmd.common import ( +from deepmd.tf.common import ( add_data_requirement, data_requirement, ) diff --git a/source/tests/test_deepdipole.py b/source/tests/test_deepdipole.py index 1d06b5fe92..6dffe59fe5 100644 --- a/source/tests/test_deepdipole.py +++ b/source/tests/test_deepdipole.py @@ -12,13 +12,13 @@ ) from packaging.version import parse as parse_version -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepDipole, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/tests/test_deepdos.py b/source/tests/test_deepdos.py index c5e100f80e..3f3d0cda7f 100644 --- a/source/tests/test_deepdos.py +++ b/source/tests/test_deepdos.py @@ -7,13 +7,13 @@ tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepDOS, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/tests/test_deepmd_data.py b/source/tests/test_deepmd_data.py index 92d89665b1..e486446ab8 100644 --- a/source/tests/test_deepmd_data.py +++ b/source/tests/test_deepmd_data.py @@ -9,10 +9,10 @@ tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.utils.data import ( +from deepmd.tf.utils.data import ( DeepmdData, ) diff --git a/source/tests/test_deepmd_data_sys.py b/source/tests/test_deepmd_data_sys.py index abfa7d7e48..49ad8f501c 100644 --- a/source/tests/test_deepmd_data_sys.py +++ b/source/tests/test_deepmd_data_sys.py @@ -5,13 +5,13 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.utils import ( +from deepmd.tf.utils import ( random, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, prob_sys_size_ext, ) diff --git a/source/tests/test_deeppolar.py b/source/tests/test_deeppolar.py index 9627851de4..18d9cb4ad9 100644 --- a/source/tests/test_deeppolar.py +++ b/source/tests/test_deeppolar.py @@ -10,13 +10,13 @@ ) from packaging.version import parse as parse_version -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPolar, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/tests/test_deeppot_a.py b/source/tests/test_deeppot_a.py index ba3655b7f9..32e92cd8bd 100644 --- a/source/tests/test_deeppot_a.py +++ b/source/tests/test_deeppot_a.py @@ -12,15 +12,15 @@ ) from packaging.version import parse as parse_version -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, MODEL_VERSION, tf, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPot, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_dp10_to_dp11, convert_dp012_to_dp10, convert_dp12_to_dp13, @@ -724,7 +724,7 @@ def test_ase(self): Atoms, ) - from deepmd.calculator import ( + from deepmd.tf.calculator import ( DP, ) diff --git a/source/tests/test_deeppot_r.py b/source/tests/test_deeppot_r.py index 44c6e3c167..47f957d2cd 100644 --- a/source/tests/test_deeppot_r.py +++ b/source/tests/test_deeppot_r.py @@ -7,14 +7,14 @@ tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, tf, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPot, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/tests/test_deeppot_spin.py b/source/tests/test_deeppot_spin.py index 9ab119a54e..b390fe6c79 100644 --- a/source/tests/test_deeppot_spin.py +++ b/source/tests/test_deeppot_spin.py @@ -7,13 +7,13 @@ tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPot, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/tests/test_descrpt_hybrid.py b/source/tests/test_descrpt_hybrid.py index 317f6ea5a0..08177f6a08 100644 --- a/source/tests/test_descrpt_hybrid.py +++ b/source/tests/test_descrpt_hybrid.py @@ -9,16 +9,16 @@ ) from packaging.version import parse as parse_version -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptHybrid, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) diff --git a/source/tests/test_descrpt_nonsmth.py b/source/tests/test_descrpt_nonsmth.py index fd3bb0b2f7..31f9da7ff2 100644 --- a/source/tests/test_descrpt_nonsmth.py +++ b/source/tests/test_descrpt_nonsmth.py @@ -11,7 +11,7 @@ ) # load grad of force module -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, GLOBAL_TF_FLOAT_PRECISION, op_module, diff --git a/source/tests/test_descrpt_se_a_mask.py b/source/tests/test_descrpt_se_a_mask.py index 85cd1cc2a1..b35bc75b04 100644 --- a/source/tests/test_descrpt_se_a_mask.py +++ b/source/tests/test_descrpt_se_a_mask.py @@ -8,19 +8,19 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeAMask, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPot, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/tests/test_descrpt_se_a_type.py b/source/tests/test_descrpt_se_a_type.py index aeab18f149..f5f294be35 100644 --- a/source/tests/test_descrpt_se_a_type.py +++ b/source/tests/test_descrpt_se_a_type.py @@ -6,16 +6,16 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) diff --git a/source/tests/test_descrpt_se_atten.py b/source/tests/test_descrpt_se_atten.py index 76df651a46..d7e3c31f2c 100644 --- a/source/tests/test_descrpt_se_atten.py +++ b/source/tests/test_descrpt_se_atten.py @@ -10,16 +10,16 @@ ) from packaging.version import parse as parse_version -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeAtten, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) diff --git a/source/tests/test_descrpt_se_r.py b/source/tests/test_descrpt_se_r.py index 779954a545..9e01bc83fd 100644 --- a/source/tests/test_descrpt_se_r.py +++ b/source/tests/test_descrpt_se_r.py @@ -11,7 +11,7 @@ ) # load grad of force module -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, GLOBAL_TF_FLOAT_PRECISION, op_module, diff --git a/source/tests/test_descrpt_sea_ef.py b/source/tests/test_descrpt_sea_ef.py index efd86854c7..42f26da887 100644 --- a/source/tests/test_descrpt_sea_ef.py +++ b/source/tests/test_descrpt_sea_ef.py @@ -11,7 +11,7 @@ ) # load grad of force module -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, GLOBAL_TF_FLOAT_PRECISION, op_module, diff --git a/source/tests/test_descrpt_sea_ef_para.py b/source/tests/test_descrpt_sea_ef_para.py index 1a109013cb..16c92a5dc7 100644 --- a/source/tests/test_descrpt_sea_ef_para.py +++ b/source/tests/test_descrpt_sea_ef_para.py @@ -11,7 +11,7 @@ ) # load grad of force module -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, GLOBAL_TF_FLOAT_PRECISION, op_module, diff --git a/source/tests/test_descrpt_sea_ef_rot.py b/source/tests/test_descrpt_sea_ef_rot.py index 56cdb357b0..8cdbc19ca2 100644 --- a/source/tests/test_descrpt_sea_ef_rot.py +++ b/source/tests/test_descrpt_sea_ef_rot.py @@ -3,11 +3,11 @@ import numpy as np -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, DescrptSeAEfLower, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, GLOBAL_TF_FLOAT_PRECISION, op_module, diff --git a/source/tests/test_descrpt_sea_ef_vert.py b/source/tests/test_descrpt_sea_ef_vert.py index 77ffb3150c..bc27a7c933 100644 --- a/source/tests/test_descrpt_sea_ef_vert.py +++ b/source/tests/test_descrpt_sea_ef_vert.py @@ -11,7 +11,7 @@ ) # load grad of force module -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, GLOBAL_TF_FLOAT_PRECISION, op_module, diff --git a/source/tests/test_descrpt_smooth.py b/source/tests/test_descrpt_smooth.py index 59076e366e..206aca8d8a 100644 --- a/source/tests/test_descrpt_smooth.py +++ b/source/tests/test_descrpt_smooth.py @@ -11,7 +11,7 @@ ) # load grad of force module -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, GLOBAL_TF_FLOAT_PRECISION, op_module, diff --git a/source/tests/test_dipole_se_a.py b/source/tests/test_dipole_se_a.py index 687e68c2be..ca31ce87d5 100644 --- a/source/tests/test_dipole_se_a.py +++ b/source/tests/test_dipole_se_a.py @@ -8,19 +8,19 @@ strerch_box, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( DipoleFittingSeA, ) -from deepmd.model import ( +from deepmd.tf.model import ( DipoleModel, ) diff --git a/source/tests/test_dipole_se_a_tebd.py b/source/tests/test_dipole_se_a_tebd.py index 4b2e6d0688..b211d0eb48 100644 --- a/source/tests/test_dipole_se_a_tebd.py +++ b/source/tests/test_dipole_se_a_tebd.py @@ -11,22 +11,22 @@ ) from packaging.version import parse as parse_version -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( DipoleFittingSeA, ) -from deepmd.model import ( +from deepmd.tf.model import ( DipoleModel, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) diff --git a/source/tests/test_dipolecharge.py b/source/tests/test_dipolecharge.py index 58459d6845..e435eb431a 100644 --- a/source/tests/test_dipolecharge.py +++ b/source/tests/test_dipolecharge.py @@ -7,13 +7,13 @@ tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DipoleChargeModifier, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/tests/test_dp_test.py b/source/tests/test_dp_test.py index a07706acfe..978cd95804 100644 --- a/source/tests/test_dp_test.py +++ b/source/tests/test_dp_test.py @@ -12,8 +12,8 @@ tests_path, ) -from deepmd.entrypoints.test import test as dp_test -from deepmd.utils.convert import ( +from deepmd.tf.entrypoints.test import test as dp_test +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/tests/test_embedding_net.py b/source/tests/test_embedding_net.py index 1b8c68c089..f766fff8b3 100644 --- a/source/tests/test_embedding_net.py +++ b/source/tests/test_embedding_net.py @@ -3,10 +3,10 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.utils.network import ( +from deepmd.tf.utils.network import ( embedding_net, ) diff --git a/source/tests/test_env.py b/source/tests/test_env.py index d575c3cf93..eb1b40e707 100644 --- a/source/tests/test_env.py +++ b/source/tests/test_env.py @@ -4,7 +4,7 @@ mock, ) -from deepmd import ( +from deepmd.tf import ( env, ) @@ -35,7 +35,7 @@ def test_default(self): new = env.get_tf_session_config() self.assertNotEqual(id(shared), id(new)) - @mock.patch("deepmd.env.get_tf_default_nthreads") + @mock.patch("deepmd.tf.env.get_tf_default_nthreads") def test_get(self, mock_method): mock_method.return_value = (5, 3) config = env.get_tf_session_config() diff --git a/source/tests/test_ewald.py b/source/tests/test_ewald.py index ef2ace39a4..74b65e9be3 100644 --- a/source/tests/test_ewald.py +++ b/source/tests/test_ewald.py @@ -1,12 +1,12 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, GLOBAL_TF_FLOAT_PRECISION, tf, ) -from deepmd.infer.ewald_recp import ( +from deepmd.tf.infer.ewald_recp import ( EwaldRecp, op_module, ) diff --git a/source/tests/test_examples.py b/source/tests/test_examples.py index d50ca5fee1..ea087fbc9d 100644 --- a/source/tests/test_examples.py +++ b/source/tests/test_examples.py @@ -7,10 +7,10 @@ Path, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_loader, ) -from deepmd.utils.argcheck import ( +from deepmd.tf.utils.argcheck import ( normalize, ) diff --git a/source/tests/test_finetune_se_atten.py b/source/tests/test_finetune_se_atten.py index f4689aacb3..3614fcb13a 100644 --- a/source/tests/test_finetune_se_atten.py +++ b/source/tests/test_finetune_se_atten.py @@ -12,23 +12,23 @@ ) from packaging.version import parse as parse_version -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, tf, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPotential, ) -from deepmd.utils.argcheck import ( +from deepmd.tf.utils.argcheck import ( normalize, ) -from deepmd.utils.compat import ( +from deepmd.tf.utils.compat import ( update_deepmd_input, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) -from deepmd.utils.graph import ( +from deepmd.tf.utils.graph import ( get_tensor_by_name, ) diff --git a/source/tests/test_fitting_dos.py b/source/tests/test_fitting_dos.py index 60a0ee4158..532bcfafbc 100644 --- a/source/tests/test_fitting_dos.py +++ b/source/tests/test_fitting_dos.py @@ -6,16 +6,16 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( DOSFitting, ) diff --git a/source/tests/test_fitting_ener_type.py b/source/tests/test_fitting_ener_type.py index 42190ef557..05a9d053ab 100644 --- a/source/tests/test_fitting_ener_type.py +++ b/source/tests/test_fitting_ener_type.py @@ -6,16 +6,16 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) diff --git a/source/tests/test_fitting_stat.py b/source/tests/test_fitting_stat.py index ad62c89f2a..2b20dd5a4c 100644 --- a/source/tests/test_fitting_stat.py +++ b/source/tests/test_fitting_stat.py @@ -9,10 +9,10 @@ j_loader, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) diff --git a/source/tests/test_gen_stat_data.py b/source/tests/test_gen_stat_data.py index 6667aa15fd..18191eb21d 100644 --- a/source/tests/test_gen_stat_data.py +++ b/source/tests/test_gen_stat_data.py @@ -5,19 +5,19 @@ import dpdata import numpy as np -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) -from deepmd.model.model_stat import ( +from deepmd.tf.model.model_stat import ( _make_all_stat_ref, make_stat_input, merge_sys_stat, ) -from deepmd.utils import random as dp_random -from deepmd.utils.data_system import ( +from deepmd.tf.utils import random as dp_random +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) diff --git a/source/tests/test_get_potential.py b/source/tests/test_get_potential.py index e2f342537a..feb264afe0 100644 --- a/source/tests/test_get_potential.py +++ b/source/tests/test_get_potential.py @@ -6,13 +6,13 @@ Path, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepDipole, DeepPolar, DeepPot, DeepPotential, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/tests/test_init_frz_model_multi.py b/source/tests/test_init_frz_model_multi.py index 6696f39319..e5e5733c7d 100644 --- a/source/tests/test_init_frz_model_multi.py +++ b/source/tests/test_init_frz_model_multi.py @@ -10,26 +10,26 @@ tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, tf, ) -from deepmd.train.run_options import ( +from deepmd.tf.train.run_options import ( RunOptions, ) -from deepmd.train.trainer import ( +from deepmd.tf.train.trainer import ( DPTrainer, ) -from deepmd.utils.argcheck import ( +from deepmd.tf.utils.argcheck import ( normalize, ) -from deepmd.utils.compat import ( +from deepmd.tf.utils.compat import ( update_deepmd_input, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) -from deepmd.utils.multi_init import ( +from deepmd.tf.utils.multi_init import ( replace_model_params_with_frz_multi_model, ) diff --git a/source/tests/test_init_frz_model_se_a.py b/source/tests/test_init_frz_model_se_a.py index 06532009d1..d98c2bc14f 100644 --- a/source/tests/test_init_frz_model_se_a.py +++ b/source/tests/test_init_frz_model_se_a.py @@ -10,23 +10,23 @@ tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, tf, ) -from deepmd.train.run_options import ( +from deepmd.tf.train.run_options import ( RunOptions, ) -from deepmd.train.trainer import ( +from deepmd.tf.train.trainer import ( DPTrainer, ) -from deepmd.utils.argcheck import ( +from deepmd.tf.utils.argcheck import ( normalize, ) -from deepmd.utils.compat import ( +from deepmd.tf.utils.compat import ( update_deepmd_input, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) diff --git a/source/tests/test_init_frz_model_se_a_tebd.py b/source/tests/test_init_frz_model_se_a_tebd.py index e54cae9781..594bf83085 100644 --- a/source/tests/test_init_frz_model_se_a_tebd.py +++ b/source/tests/test_init_frz_model_se_a_tebd.py @@ -10,23 +10,23 @@ tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, tf, ) -from deepmd.train.run_options import ( +from deepmd.tf.train.run_options import ( RunOptions, ) -from deepmd.train.trainer import ( +from deepmd.tf.train.trainer import ( DPTrainer, ) -from deepmd.utils.argcheck import ( +from deepmd.tf.utils.argcheck import ( normalize, ) -from deepmd.utils.compat import ( +from deepmd.tf.utils.compat import ( update_deepmd_input, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) diff --git a/source/tests/test_init_frz_model_se_a_type.py b/source/tests/test_init_frz_model_se_a_type.py index 9d2c49579a..3221245065 100644 --- a/source/tests/test_init_frz_model_se_a_type.py +++ b/source/tests/test_init_frz_model_se_a_type.py @@ -10,23 +10,23 @@ tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, tf, ) -from deepmd.train.run_options import ( +from deepmd.tf.train.run_options import ( RunOptions, ) -from deepmd.train.trainer import ( +from deepmd.tf.train.trainer import ( DPTrainer, ) -from deepmd.utils.argcheck import ( +from deepmd.tf.utils.argcheck import ( normalize, ) -from deepmd.utils.compat import ( +from deepmd.tf.utils.compat import ( update_deepmd_input, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) diff --git a/source/tests/test_init_frz_model_se_atten.py b/source/tests/test_init_frz_model_se_atten.py index 01956e51c4..5554ae415c 100644 --- a/source/tests/test_init_frz_model_se_atten.py +++ b/source/tests/test_init_frz_model_se_atten.py @@ -11,23 +11,23 @@ ) from packaging.version import parse as parse_version -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, tf, ) -from deepmd.train.run_options import ( +from deepmd.tf.train.run_options import ( RunOptions, ) -from deepmd.train.trainer import ( +from deepmd.tf.train.trainer import ( DPTrainer, ) -from deepmd.utils.argcheck import ( +from deepmd.tf.utils.argcheck import ( normalize, ) -from deepmd.utils.compat import ( +from deepmd.tf.utils.compat import ( update_deepmd_input, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) diff --git a/source/tests/test_init_frz_model_se_r.py b/source/tests/test_init_frz_model_se_r.py index 34eca9bd05..84d109bcfd 100644 --- a/source/tests/test_init_frz_model_se_r.py +++ b/source/tests/test_init_frz_model_se_r.py @@ -10,23 +10,23 @@ tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, tf, ) -from deepmd.train.run_options import ( +from deepmd.tf.train.run_options import ( RunOptions, ) -from deepmd.train.trainer import ( +from deepmd.tf.train.trainer import ( DPTrainer, ) -from deepmd.utils.argcheck import ( +from deepmd.tf.utils.argcheck import ( normalize, ) -from deepmd.utils.compat import ( +from deepmd.tf.utils.compat import ( update_deepmd_input, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) diff --git a/source/tests/test_init_frz_model_spin.py b/source/tests/test_init_frz_model_spin.py index c6f257dd7b..7aa3d514dc 100644 --- a/source/tests/test_init_frz_model_spin.py +++ b/source/tests/test_init_frz_model_spin.py @@ -10,23 +10,23 @@ tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, tf, ) -from deepmd.train.run_options import ( +from deepmd.tf.train.run_options import ( RunOptions, ) -from deepmd.train.trainer import ( +from deepmd.tf.train.trainer import ( DPTrainer, ) -from deepmd.utils.argcheck import ( +from deepmd.tf.utils.argcheck import ( normalize, ) -from deepmd.utils.compat import ( +from deepmd.tf.utils.compat import ( update_deepmd_input, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) diff --git a/source/tests/test_lammps.py b/source/tests/test_lammps.py index 19dbe70ade..d235d6576e 100644 --- a/source/tests/test_lammps.py +++ b/source/tests/test_lammps.py @@ -6,7 +6,7 @@ Path, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/tests/test_layer_name.py b/source/tests/test_layer_name.py index c6a2f0b09c..71229b5ce7 100644 --- a/source/tests/test_layer_name.py +++ b/source/tests/test_layer_name.py @@ -7,20 +7,20 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( DipoleFittingSeA, EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( MultiModel, ) diff --git a/source/tests/test_linear_model.py b/source/tests/test_linear_model.py index 21f0f6efc8..ef0d324a69 100644 --- a/source/tests/test_linear_model.py +++ b/source/tests/test_linear_model.py @@ -4,18 +4,18 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_ENER_FLOAT_PRECISION, GLOBAL_TF_FLOAT_PRECISION, tf, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPotential, ) -from deepmd.model.linear import ( +from deepmd.tf.model.linear import ( LinearEnergyModel, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/tests/test_loss_gf.py b/source/tests/test_loss_gf.py index 04f40d943b..78e5404e03 100644 --- a/source/tests/test_loss_gf.py +++ b/source/tests/test_loss_gf.py @@ -2,7 +2,7 @@ import numpy as np import tensorflow as tf -from deepmd.loss import ( +from deepmd.tf.loss import ( EnerStdLoss, ) diff --git a/source/tests/test_mixed_prec_training.py b/source/tests/test_mixed_prec_training.py index d4c859f958..620a9b9fd0 100644 --- a/source/tests/test_mixed_prec_training.py +++ b/source/tests/test_mixed_prec_training.py @@ -6,7 +6,7 @@ import numpy as np -# from deepmd.entrypoints.compress import compress +# from deepmd.tf.entrypoints.compress import compress from common import ( j_loader, run_dp, @@ -16,7 +16,7 @@ Version, ) -from deepmd.env import ( +from deepmd.tf.env import ( TF_VERSION, ) diff --git a/source/tests/test_model_compression_se_a.py b/source/tests/test_model_compression_se_a.py index 0e6e1361ad..0a6b7c85cb 100644 --- a/source/tests/test_model_compression_se_a.py +++ b/source/tests/test_model_compression_se_a.py @@ -6,17 +6,17 @@ import numpy as np -# from deepmd.entrypoints.compress import compress +# from deepmd.tf.entrypoints.compress import compress from common import ( j_loader, run_dp, tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPot, ) @@ -404,7 +404,7 @@ def test_ase(self): Atoms, ) - from deepmd.calculator import ( + from deepmd.tf.calculator import ( DP, ) diff --git a/source/tests/test_model_compression_se_a_ebd.py b/source/tests/test_model_compression_se_a_ebd.py index 2a3163b062..8b64117acd 100644 --- a/source/tests/test_model_compression_se_a_ebd.py +++ b/source/tests/test_model_compression_se_a_ebd.py @@ -6,17 +6,17 @@ import numpy as np -# from deepmd.entrypoints.compress import compress +# from deepmd.tf.entrypoints.compress import compress from common import ( j_loader, run_dp, tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPot, ) @@ -416,7 +416,7 @@ def test_ase(self): Atoms, ) - from deepmd.calculator import ( + from deepmd.tf.calculator import ( DP, ) diff --git a/source/tests/test_model_compression_se_a_ebd_type_one_side.py b/source/tests/test_model_compression_se_a_ebd_type_one_side.py index 2f3d16b05f..9ad1970e9b 100644 --- a/source/tests/test_model_compression_se_a_ebd_type_one_side.py +++ b/source/tests/test_model_compression_se_a_ebd_type_one_side.py @@ -6,17 +6,17 @@ import numpy as np -# from deepmd.entrypoints.compress import compress +# from deepmd.tf.entrypoints.compress import compress from common import ( j_loader, run_dp, tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPot, ) @@ -416,7 +416,7 @@ def test_ase(self): Atoms, ) - from deepmd.calculator import ( + from deepmd.tf.calculator import ( DP, ) diff --git a/source/tests/test_model_compression_se_a_type_one_side_exclude_types.py b/source/tests/test_model_compression_se_a_type_one_side_exclude_types.py index 10ce352b6c..5b6ac4e13e 100644 --- a/source/tests/test_model_compression_se_a_type_one_side_exclude_types.py +++ b/source/tests/test_model_compression_se_a_type_one_side_exclude_types.py @@ -6,17 +6,17 @@ import numpy as np -# from deepmd.entrypoints.compress import compress +# from deepmd.tf.entrypoints.compress import compress from common import ( j_loader, run_dp, tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPot, ) diff --git a/source/tests/test_model_compression_se_atten.py b/source/tests/test_model_compression_se_atten.py index 6bab1a3881..2e250fe80e 100644 --- a/source/tests/test_model_compression_se_atten.py +++ b/source/tests/test_model_compression_se_atten.py @@ -6,7 +6,7 @@ import numpy as np -# from deepmd.entrypoints.compress import compress +# from deepmd.tf.entrypoints.compress import compress from common import ( j_loader, run_dp, @@ -14,10 +14,10 @@ ) from packaging.version import parse as parse_version -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPot, ) @@ -552,7 +552,7 @@ def test_ase(self): Atoms, ) - from deepmd.calculator import ( + from deepmd.tf.calculator import ( DP, ) diff --git a/source/tests/test_model_compression_se_r.py b/source/tests/test_model_compression_se_r.py index f79cdbee6c..0c5912164f 100644 --- a/source/tests/test_model_compression_se_r.py +++ b/source/tests/test_model_compression_se_r.py @@ -6,17 +6,17 @@ import numpy as np -# from deepmd.entrypoints.compress import compress +# from deepmd.tf.entrypoints.compress import compress from common import ( j_loader, run_dp, tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPot, ) @@ -390,7 +390,7 @@ def test_ase(self): Atoms, ) - from deepmd.calculator import ( + from deepmd.tf.calculator import ( DP, ) diff --git a/source/tests/test_model_compression_se_t.py b/source/tests/test_model_compression_se_t.py index 48fee4ea1d..eb33ce2b93 100644 --- a/source/tests/test_model_compression_se_t.py +++ b/source/tests/test_model_compression_se_t.py @@ -6,17 +6,17 @@ import numpy as np -# from deepmd.entrypoints.compress import compress +# from deepmd.tf.entrypoints.compress import compress from common import ( j_loader, run_dp, tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPot, ) @@ -412,7 +412,7 @@ def test_ase(self): Atoms, ) - from deepmd.calculator import ( + from deepmd.tf.calculator import ( DP, ) diff --git a/source/tests/test_model_devi.py b/source/tests/test_model_devi.py index c7d050cd76..21275ee2d1 100644 --- a/source/tests/test_model_devi.py +++ b/source/tests/test_model_devi.py @@ -5,11 +5,11 @@ import numpy as np -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPotential, calc_model_devi, ) -from deepmd.infer.model_devi import ( +from deepmd.tf.infer.model_devi import ( make_model_devi, ) @@ -20,7 +20,7 @@ tests_path, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/tests/test_model_devi_mix.py b/source/tests/test_model_devi_mix.py index 98caf409eb..5715b49165 100644 --- a/source/tests/test_model_devi_mix.py +++ b/source/tests/test_model_devi_mix.py @@ -5,11 +5,11 @@ import numpy as np -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPotential, calc_model_devi, ) -from deepmd.infer.model_devi import ( +from deepmd.tf.infer.model_devi import ( make_model_devi, ) @@ -21,10 +21,10 @@ ) from packaging.version import parse as parse_version -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/tests/test_model_dos.py b/source/tests/test_model_dos.py index c7160d4dda..72cd9db524 100644 --- a/source/tests/test_model_dos.py +++ b/source/tests/test_model_dos.py @@ -7,19 +7,19 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( DOSFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( DOSModel, ) diff --git a/source/tests/test_model_loc_frame.py b/source/tests/test_model_loc_frame.py index c493013316..035ffc868e 100644 --- a/source/tests/test_model_loc_frame.py +++ b/source/tests/test_model_loc_frame.py @@ -6,19 +6,19 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptLocFrame, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( EnerModel, ) diff --git a/source/tests/test_model_multi.py b/source/tests/test_model_multi.py index 9017da22e7..fa75951366 100644 --- a/source/tests/test_model_multi.py +++ b/source/tests/test_model_multi.py @@ -9,20 +9,20 @@ strerch_box, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( DipoleFittingSeA, EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( MultiModel, ) diff --git a/source/tests/test_model_pairtab.py b/source/tests/test_model_pairtab.py index fd678894b5..8a7ebd605c 100644 --- a/source/tests/test_model_pairtab.py +++ b/source/tests/test_model_pairtab.py @@ -7,13 +7,13 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.model.model import ( +from deepmd.tf.model.model import ( Model, ) diff --git a/source/tests/test_model_se_a.py b/source/tests/test_model_se_a.py index d3b4323f0d..f537452385 100644 --- a/source/tests/test_model_se_a.py +++ b/source/tests/test_model_se_a.py @@ -8,22 +8,22 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( EnerModel, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) diff --git a/source/tests/test_model_se_a_aparam.py b/source/tests/test_model_se_a_aparam.py index 41111c57ee..aca2d8c63c 100644 --- a/source/tests/test_model_se_a_aparam.py +++ b/source/tests/test_model_se_a_aparam.py @@ -6,19 +6,19 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( EnerModel, ) diff --git a/source/tests/test_model_se_a_ebd.py b/source/tests/test_model_se_a_ebd.py index bf856b7bc5..2e133a9a63 100644 --- a/source/tests/test_model_se_a_ebd.py +++ b/source/tests/test_model_se_a_ebd.py @@ -6,19 +6,19 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor.se_a_ebd import ( +from deepmd.tf.descriptor.se_a_ebd import ( DescrptSeAEbd, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( EnerModel, ) diff --git a/source/tests/test_model_se_a_ebd_v2.py b/source/tests/test_model_se_a_ebd_v2.py index 71860890ce..f302308a73 100644 --- a/source/tests/test_model_se_a_ebd_v2.py +++ b/source/tests/test_model_se_a_ebd_v2.py @@ -6,22 +6,22 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor.se_a_ebd_v2 import ( +from deepmd.tf.descriptor.se_a_ebd_v2 import ( DescrptSeAEbdV2, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( EnerModel, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) diff --git a/source/tests/test_model_se_a_fparam.py b/source/tests/test_model_se_a_fparam.py index cdb85157a4..46aac18fcb 100644 --- a/source/tests/test_model_se_a_fparam.py +++ b/source/tests/test_model_se_a_fparam.py @@ -6,19 +6,19 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( EnerModel, ) diff --git a/source/tests/test_model_se_a_srtab.py b/source/tests/test_model_se_a_srtab.py index 98cab9e073..3fcb55050d 100644 --- a/source/tests/test_model_se_a_srtab.py +++ b/source/tests/test_model_se_a_srtab.py @@ -8,19 +8,19 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( EnerModel, ) diff --git a/source/tests/test_model_se_a_type.py b/source/tests/test_model_se_a_type.py index 85e4a2916d..bc2a2c3045 100644 --- a/source/tests/test_model_se_a_type.py +++ b/source/tests/test_model_se_a_type.py @@ -6,22 +6,22 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( EnerModel, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) diff --git a/source/tests/test_model_se_atten.py b/source/tests/test_model_se_atten.py index 5417201a9f..592858db2a 100644 --- a/source/tests/test_model_se_atten.py +++ b/source/tests/test_model_se_atten.py @@ -12,22 +12,22 @@ ) from packaging.version import parse as parse_version -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeAtten, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( EnerModel, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) diff --git a/source/tests/test_model_se_r.py b/source/tests/test_model_se_r.py index 94812308c6..acfe6e95dd 100644 --- a/source/tests/test_model_se_r.py +++ b/source/tests/test_model_se_r.py @@ -6,19 +6,19 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeR, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( EnerModel, ) diff --git a/source/tests/test_model_se_t.py b/source/tests/test_model_se_t.py index 1d67e852c7..cb8ed97833 100644 --- a/source/tests/test_model_se_t.py +++ b/source/tests/test_model_se_t.py @@ -6,19 +6,19 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeT, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( EnerModel, ) diff --git a/source/tests/test_model_spin.py b/source/tests/test_model_spin.py index 9bdf1d780a..d1a6f59fe1 100644 --- a/source/tests/test_model_spin.py +++ b/source/tests/test_model_spin.py @@ -10,22 +10,22 @@ tests_path, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( EnerFitting, ) -from deepmd.model import ( +from deepmd.tf.model import ( EnerModel, ) -from deepmd.utils.spin import ( +from deepmd.tf.utils.spin import ( Spin, ) diff --git a/source/tests/test_neighbor_stat.py b/source/tests/test_neighbor_stat.py index 49ace29f53..9806e2053a 100644 --- a/source/tests/test_neighbor_stat.py +++ b/source/tests/test_neighbor_stat.py @@ -5,7 +5,7 @@ import dpdata import numpy as np -from deepmd.entrypoints.neighbor_stat import ( +from deepmd.tf.entrypoints.neighbor_stat import ( neighbor_stat, ) diff --git a/source/tests/test_nvnmd_entrypoints.py b/source/tests/test_nvnmd_entrypoints.py index d82c905024..b257f8fffa 100644 --- a/source/tests/test_nvnmd_entrypoints.py +++ b/source/tests/test_nvnmd_entrypoints.py @@ -7,40 +7,40 @@ tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, tf, ) -from deepmd.nvnmd.data.data import ( +from deepmd.tf.nvnmd.data.data import ( jdata_deepmd_input_v0, jdata_deepmd_input_v1, ) -from deepmd.nvnmd.entrypoints.freeze import ( +from deepmd.tf.nvnmd.entrypoints.freeze import ( save_weight, ) -from deepmd.nvnmd.entrypoints.mapt import ( +from deepmd.tf.nvnmd.entrypoints.mapt import ( MapTable, ) -from deepmd.nvnmd.entrypoints.wrap import ( +from deepmd.tf.nvnmd.entrypoints.wrap import ( wrap, ) -from deepmd.nvnmd.utils.config import ( +from deepmd.tf.nvnmd.utils.config import ( nvnmd_cfg, ) -from deepmd.nvnmd.utils.fio import ( +from deepmd.tf.nvnmd.utils.fio import ( FioBin, FioNpyDic, ) -from deepmd.train.run_options import ( +from deepmd.tf.train.run_options import ( RunOptions, ) -from deepmd.train.trainer import ( +from deepmd.tf.train.trainer import ( DPTrainer, ) -from deepmd.utils.argcheck import ( +from deepmd.tf.utils.argcheck import ( normalize, ) -from deepmd.utils.compat import ( +from deepmd.tf.utils.compat import ( update_deepmd_input, ) diff --git a/source/tests/test_nvnmd_op.py b/source/tests/test_nvnmd_op.py index 3419b375e4..beff8375b8 100644 --- a/source/tests/test_nvnmd_op.py +++ b/source/tests/test_nvnmd_op.py @@ -4,7 +4,7 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( op_module, tf, ) diff --git a/source/tests/test_pairwise_dprc.py b/source/tests/test_pairwise_dprc.py index e95b66c7a0..a38c856c26 100644 --- a/source/tests/test_pairwise_dprc.py +++ b/source/tests/test_pairwise_dprc.py @@ -11,30 +11,30 @@ ) from packaging.version import parse as parse_version -from deepmd import ( +from deepmd.tf import ( DeepPotential, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_loader, j_must_have, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_ENER_FLOAT_PRECISION, GLOBAL_NP_FLOAT_PRECISION, GLOBAL_TF_FLOAT_PRECISION, op_module, tf, ) -from deepmd.model.model import ( +from deepmd.tf.model.model import ( Model, ) -from deepmd.model.pairwise_dprc import ( +from deepmd.tf.model.pairwise_dprc import ( gather_placeholder, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) -from deepmd.utils.sess import ( +from deepmd.tf.utils.sess import ( run_sess, ) diff --git a/source/tests/test_parallel_training.py b/source/tests/test_parallel_training.py index 0a1a63a29b..85311cf558 100644 --- a/source/tests/test_parallel_training.py +++ b/source/tests/test_parallel_training.py @@ -7,7 +7,7 @@ tests_path, ) -from deepmd.cluster.local import ( +from deepmd.tf.cluster.local import ( get_gpus, ) diff --git a/source/tests/test_polar_se_a.py b/source/tests/test_polar_se_a.py index 2564dc0656..39c34f0a01 100644 --- a/source/tests/test_polar_se_a.py +++ b/source/tests/test_polar_se_a.py @@ -8,19 +8,19 @@ strerch_box, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( PolarFittingSeA, ) -from deepmd.model import ( +from deepmd.tf.model import ( PolarModel, ) diff --git a/source/tests/test_polar_se_a_tebd.py b/source/tests/test_polar_se_a_tebd.py index 570c4261d9..1c82488dca 100644 --- a/source/tests/test_polar_se_a_tebd.py +++ b/source/tests/test_polar_se_a_tebd.py @@ -11,22 +11,22 @@ ) from packaging.version import parse as parse_version -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( DescrptSeA, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.fit import ( +from deepmd.tf.fit import ( PolarFittingSeA, ) -from deepmd.model import ( +from deepmd.tf.model import ( PolarModel, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, ) diff --git a/source/tests/test_prod_env_mat.py b/source/tests/test_prod_env_mat.py index 663b991831..ac1c16bf97 100644 --- a/source/tests/test_prod_env_mat.py +++ b/source/tests/test_prod_env_mat.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, GLOBAL_TF_FLOAT_PRECISION, op_module, diff --git a/source/tests/test_prod_force.py b/source/tests/test_prod_force.py index 83a44c0be9..7d3bcee6ce 100644 --- a/source/tests/test_prod_force.py +++ b/source/tests/test_prod_force.py @@ -4,7 +4,7 @@ import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, op_module, tf, diff --git a/source/tests/test_prod_force_grad.py b/source/tests/test_prod_force_grad.py index 012def217f..49e63d161c 100644 --- a/source/tests/test_prod_force_grad.py +++ b/source/tests/test_prod_force_grad.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, op_grads_module, tf, diff --git a/source/tests/test_prod_virial.py b/source/tests/test_prod_virial.py index 2abcfcb1bf..fa6347382e 100644 --- a/source/tests/test_prod_virial.py +++ b/source/tests/test_prod_virial.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, op_module, tf, diff --git a/source/tests/test_prod_virial_grad.py b/source/tests/test_prod_virial_grad.py index 548b63a54b..470441a939 100644 --- a/source/tests/test_prod_virial_grad.py +++ b/source/tests/test_prod_virial_grad.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_TF_FLOAT_PRECISION, op_grads_module, tf, diff --git a/source/tests/test_sel_idx.py b/source/tests/test_sel_idx.py index d6630e3e83..e340ba55e7 100644 --- a/source/tests/test_sel_idx.py +++ b/source/tests/test_sel_idx.py @@ -3,7 +3,7 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( select_idx_map, ) diff --git a/source/tests/test_tab_nonsmth.py b/source/tests/test_tab_nonsmth.py index 9e3f9ff640..6b09b98428 100644 --- a/source/tests/test_tab_nonsmth.py +++ b/source/tests/test_tab_nonsmth.py @@ -15,12 +15,12 @@ ) # load grad of force module -import deepmd.op # noqa: F401 -from deepmd.env import ( +import deepmd.tf.op # noqa: F401 +from deepmd.tf.env import ( op_module, tf, ) -from deepmd.utils.pair_tab import ( +from deepmd.tf.utils.pair_tab import ( PairTab, ) diff --git a/source/tests/test_tab_smooth.py b/source/tests/test_tab_smooth.py index 49b18e14f3..f823b366c8 100644 --- a/source/tests/test_tab_smooth.py +++ b/source/tests/test_tab_smooth.py @@ -15,11 +15,11 @@ ) # load grad of force module -from deepmd.env import ( +from deepmd.tf.env import ( op_module, tf, ) -from deepmd.utils.pair_tab import ( +from deepmd.tf.utils.pair_tab import ( PairTab, ) diff --git a/source/tests/test_tabulate.py b/source/tests/test_tabulate.py index 12c805fe79..2ffb5e19c6 100644 --- a/source/tests/test_tabulate.py +++ b/source/tests/test_tabulate.py @@ -3,10 +3,10 @@ import numpy as np -from deepmd.common import ( +from deepmd.tf.common import ( gelu, ) -from deepmd.env import ( +from deepmd.tf.env import ( op_module, tf, ) diff --git a/source/tests/test_train.py b/source/tests/test_train.py index 145457260f..3da62475ea 100644 --- a/source/tests/test_train.py +++ b/source/tests/test_train.py @@ -4,7 +4,7 @@ patch, ) -from deepmd.entrypoints.train import ( +from deepmd.tf.entrypoints.train import ( parse_auto_sel, parse_auto_sel_ratio, update_one_sel, @@ -31,7 +31,7 @@ def test_train_parse_auto_sel_ratio(self): with self.assertRaises(RuntimeError): parse_auto_sel_ratio([1, 2, 3]) - @patch("deepmd.entrypoints.train.get_sel") + @patch("deepmd.tf.entrypoints.train.get_sel") def test_update_one_sel(self, sel_mock): sel_mock.return_value = [10, 20] jdata = {} @@ -44,7 +44,7 @@ def test_update_one_sel(self, sel_mock): # self.assertEqual(descriptor['sel'], [15,30]) self.assertEqual(descriptor["sel"], [16, 32]) - @patch("deepmd.entrypoints.train.get_sel") + @patch("deepmd.tf.entrypoints.train.get_sel") def test_update_sel_hybrid(self, sel_mock): sel_mock.return_value = [10, 20] jdata = { @@ -72,7 +72,7 @@ def test_update_sel_hybrid(self, sel_mock): jdata = update_sel(jdata) self.assertEqual(jdata, expected_out) - @patch("deepmd.entrypoints.train.get_sel") + @patch("deepmd.tf.entrypoints.train.get_sel") def test_update_sel(self, sel_mock): sel_mock.return_value = [10, 20] jdata = {"model": {"descriptor": {"type": "se_e2_a", "rcut": 6, "sel": "auto"}}} @@ -82,7 +82,7 @@ def test_update_sel(self, sel_mock): jdata = update_sel(jdata) self.assertEqual(jdata, expected_out) - @patch("deepmd.entrypoints.train.get_sel") + @patch("deepmd.tf.entrypoints.train.get_sel") def test_update_sel_atten_auto(self, sel_mock): sel_mock.return_value = [25] jdata = { @@ -106,7 +106,7 @@ def test_update_sel_atten_auto(self, sel_mock): jdata = update_sel(jdata) self.assertEqual(jdata, expected_out) - @patch("deepmd.entrypoints.train.get_sel") + @patch("deepmd.tf.entrypoints.train.get_sel") def test_update_sel_atten_int(self, sel_mock): sel_mock.return_value = [25] jdata = { @@ -130,7 +130,7 @@ def test_update_sel_atten_int(self, sel_mock): jdata = update_sel(jdata) self.assertEqual(jdata, expected_out) - @patch("deepmd.entrypoints.train.get_sel") + @patch("deepmd.tf.entrypoints.train.get_sel") def test_update_sel_atten_list(self, sel_mock): sel_mock.return_value = [25] jdata = { @@ -200,7 +200,7 @@ def test_skip_linear_frozen(self): jdata = update_sel(jdata) self.assertEqual(jdata, expected_out) - @patch("deepmd.entrypoints.train.get_min_nbor_dist") + @patch("deepmd.tf.entrypoints.train.get_min_nbor_dist") def test_pairwise_dprc(self, sel_mock): sel_mock.return_value = 0.5 jdata = { diff --git a/source/tests/test_transfer.py b/source/tests/test_transfer.py index 27b97571c9..f73c9eef66 100644 --- a/source/tests/test_transfer.py +++ b/source/tests/test_transfer.py @@ -9,13 +9,13 @@ tests_path, ) -from deepmd.env import ( +from deepmd.tf.env import ( GLOBAL_NP_FLOAT_PRECISION, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPot, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) diff --git a/source/tests/test_type_embed.py b/source/tests/test_type_embed.py index 3e79bad70b..ceaf2cc5ff 100644 --- a/source/tests/test_type_embed.py +++ b/source/tests/test_type_embed.py @@ -1,10 +1,10 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) -from deepmd.utils.type_embed import ( +from deepmd.tf.utils.type_embed import ( TypeEmbedNet, embed_atom_type, ) diff --git a/source/tests/test_type_one_side.py b/source/tests/test_type_one_side.py index 8e7c173912..d1c02981e7 100644 --- a/source/tests/test_type_one_side.py +++ b/source/tests/test_type_one_side.py @@ -6,13 +6,13 @@ j_loader, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.descriptor import ( +from deepmd.tf.descriptor import ( Descriptor, ) -from deepmd.env import ( +from deepmd.tf.env import ( tf, ) diff --git a/source/tests/test_uni_infer.py b/source/tests/test_uni_infer.py index 6b70d17f7e..ea82507069 100644 --- a/source/tests/test_uni_infer.py +++ b/source/tests/test_uni_infer.py @@ -8,8 +8,8 @@ tests_path, ) -from deepmd.infer.deep_pot import DeepPot as DeepPotTF -from deepmd.utils.convert import ( +from deepmd.tf.infer.deep_pot import DeepPot as DeepPotTF +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) from deepmd_utils.infer.deep_pot import DeepPot as DeepPot diff --git a/source/tests/test_virtual_type.py b/source/tests/test_virtual_type.py index f7fc3c0127..0aca54dfd6 100644 --- a/source/tests/test_virtual_type.py +++ b/source/tests/test_virtual_type.py @@ -10,19 +10,19 @@ tests_path, ) -from deepmd.common import ( +from deepmd.tf.common import ( j_must_have, ) -from deepmd.infer import ( +from deepmd.tf.infer import ( DeepPot, ) -from deepmd.utils.convert import ( +from deepmd.tf.utils.convert import ( convert_pbtxt_to_pb, ) -from deepmd.utils.data_system import ( +from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) -from deepmd.utils.neighbor_stat import ( +from deepmd.tf.utils.neighbor_stat import ( NeighborStat, )