Skip to content

Commit

Permalink
Merge pull request #4 from deepmodeling/devel
Browse files Browse the repository at this point in the history
Devel update
  • Loading branch information
iProzd authored Apr 19, 2021
2 parents ffc3c14 + c6ae183 commit 7feb3a4
Show file tree
Hide file tree
Showing 252 changed files with 149,319 additions and 3,556 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jobs:
- uses: actions/checkout@master
with:
submodules: true
- run: sudo apt update && sudo apt install nvidia-cuda-toolkit
- run: sudo apt update && sudo apt install g++-7
- run: sudo apt install nvidia-cuda-toolkit
if: matrix.variant == 'gpu'
- run: source/install/build_cc.sh
env:
Expand Down
2 changes: 1 addition & 1 deletion deepmd/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Package dp entry point."""

from .main import main
from .entrypoints.main import main

if __name__ == '__main__':
main()
5 changes: 2 additions & 3 deletions source/train/calculator.py → deepmd/calculator.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
"""ASE calculator interface module."""

from typing import TYPE_CHECKING, Dict, List, Optional, Union
from pathlib import Path

from deepmd import DeepPotential
from ase.calculators.calculator import Calculator, all_changes

if TYPE_CHECKING:
from pathlib import Path

from ase import Atoms

__all__ = ["DP"]
Expand Down Expand Up @@ -62,7 +61,7 @@ def __init__(
**kwargs
) -> None:
Calculator.__init__(self, label=label, **kwargs)
self.dp = DeepPot(str(Path(model).resolve()))
self.dp = DeepPotential(str(Path(model).resolve()))
if type_dict:
self.type_dict = type_dict
else:
Expand Down
2 changes: 1 addition & 1 deletion deepmd/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import yaml

from deepmd.env import op_module, tf
from deepmd.run_options import GLOBAL_TF_FLOAT_PRECISION, GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import GLOBAL_TF_FLOAT_PRECISION, GLOBAL_NP_FLOAT_PRECISION

if TYPE_CHECKING:
_DICT_VAL = TypeVar("_DICT_VAL")
Expand Down
4 changes: 2 additions & 2 deletions deepmd/descriptor/hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from deepmd.env import tf
from deepmd.common import ClassArg
from deepmd.env import op_module
from deepmd.run_options import GLOBAL_TF_FLOAT_PRECISION
from deepmd.run_options import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import GLOBAL_TF_FLOAT_PRECISION
from deepmd.env import GLOBAL_NP_FLOAT_PRECISION
# from deepmd.descriptor import DescrptLocFrame
# from deepmd.descriptor import DescrptSeA
# from deepmd.descriptor import DescrptSeAT
Expand Down
4 changes: 2 additions & 2 deletions deepmd/descriptor/loc_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from typing import Tuple, List

from deepmd.env import tf
from deepmd.run_options import GLOBAL_TF_FLOAT_PRECISION
from deepmd.run_options import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import GLOBAL_TF_FLOAT_PRECISION
from deepmd.env import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import op_module
from deepmd.env import default_tf_session_config

Expand Down
8 changes: 4 additions & 4 deletions deepmd/descriptor/se_a.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from deepmd.env import tf
from deepmd.common import get_activation_func, get_precision, ACTIVATION_FN_DICT, PRECISION_DICT, docstring_parameter, get_np_precision
from deepmd.utils.argcheck import list_to_doc
from deepmd.run_options import GLOBAL_TF_FLOAT_PRECISION
from deepmd.run_options import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import GLOBAL_TF_FLOAT_PRECISION
from deepmd.env import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import op_module
from deepmd.env import default_tf_session_config
from deepmd.utils.network import embedding_net
Expand Down Expand Up @@ -112,7 +112,7 @@ def __init__ (self,
self.place_holders['natoms_vec'] = tf.placeholder(tf.int32, [self.ntypes+2], name=name_pfx+'t_natoms')
self.place_holders['default_mesh'] = tf.placeholder(tf.int32, [None], name=name_pfx+'t_mesh')
self.stat_descrpt, descrpt_deriv, rij, nlist \
= op_module.descrpt_se_a(self.place_holders['coord'],
= op_module.prod_env_mat_a(self.place_holders['coord'],
self.place_holders['type'],
self.place_holders['natoms_vec'],
self.place_holders['box'],
Expand Down Expand Up @@ -340,7 +340,7 @@ def build (self,
atype = tf.reshape (atype_, [-1, natoms[1]])

self.descrpt, self.descrpt_deriv, self.rij, self.nlist \
= op_module.descrpt_se_a (coord,
= op_module.prod_env_mat_a (coord,
atype,
natoms,
box,
Expand Down
7 changes: 4 additions & 3 deletions deepmd/descriptor/se_a_ebd.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from deepmd.env import tf
from deepmd.common import ClassArg, get_activation_func, get_precision, add_data_requirement
from deepmd.utils.network import one_layer
from deepmd.run_options import GLOBAL_TF_FLOAT_PRECISION
from deepmd.run_options import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import GLOBAL_TF_FLOAT_PRECISION
from deepmd.env import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import op_module
from deepmd.env import default_tf_session_config
from deepmd.utils.network import embedding_net
Expand All @@ -27,7 +27,8 @@ def __init__ (self,
numb_aparam : int = 0,
set_davg_zero: bool = False,
activation_function: str = 'tanh',
precision: str = 'default'
precision: str = 'default',
exclude_types: List[int] = [],
) -> None:
"""
Constructor
Expand Down
4 changes: 2 additions & 2 deletions deepmd/descriptor/se_a_ef.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from deepmd.env import tf
from deepmd.common import add_data_requirement,get_activation_func, get_precision, ACTIVATION_FN_DICT, PRECISION_DICT, docstring_parameter
from deepmd.utils.argcheck import list_to_doc
from deepmd.run_options import GLOBAL_TF_FLOAT_PRECISION
from deepmd.run_options import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import GLOBAL_TF_FLOAT_PRECISION
from deepmd.env import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import op_module
from deepmd.env import default_tf_session_config
from .se_a import DescrptSeA
Expand Down
4 changes: 2 additions & 2 deletions deepmd/descriptor/se_a_t.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from deepmd.env import tf
from deepmd.common import get_activation_func, get_precision, ACTIVATION_FN_DICT, PRECISION_DICT, docstring_parameter
from deepmd.utils.argcheck import list_to_doc
from deepmd.run_options import GLOBAL_TF_FLOAT_PRECISION
from deepmd.run_options import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import GLOBAL_TF_FLOAT_PRECISION
from deepmd.env import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import op_module
from deepmd.env import default_tf_session_config
from deepmd.utils.network import embedding_net
Expand Down
8 changes: 4 additions & 4 deletions deepmd/descriptor/se_r.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from deepmd.env import tf
from deepmd.common import get_activation_func, get_precision, ACTIVATION_FN_DICT, PRECISION_DICT, docstring_parameter
from deepmd.utils.argcheck import list_to_doc
from deepmd.run_options import GLOBAL_TF_FLOAT_PRECISION
from deepmd.run_options import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import GLOBAL_TF_FLOAT_PRECISION
from deepmd.env import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import op_module
from deepmd.env import default_tf_session_config
from deepmd.utils.network import embedding_net
Expand Down Expand Up @@ -112,7 +112,7 @@ def __init__ (self,
self.place_holders['natoms_vec'] = tf.placeholder(tf.int32, [self.ntypes+2], name=name_pfx+'t_natoms')
self.place_holders['default_mesh'] = tf.placeholder(tf.int32, [None], name=name_pfx+'t_mesh')
self.stat_descrpt, descrpt_deriv, rij, nlist \
= op_module.descrpt_se_r(self.place_holders['coord'],
= op_module.prod_env_mat_r(self.place_holders['coord'],
self.place_holders['type'],
self.place_holders['natoms_vec'],
self.place_holders['box'],
Expand Down Expand Up @@ -285,7 +285,7 @@ def build (self,
atype = tf.reshape (atype_, [-1, natoms[1]])

self.descrpt, self.descrpt_deriv, self.rij, self.nlist \
= op_module.descrpt_se_r (coord,
= op_module.prod_env_mat_r(coord,
atype,
natoms,
box,
Expand Down
4 changes: 4 additions & 0 deletions deepmd/entrypoints/freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def _make_node_names(model_type: str, modifier_type: Optional[str] = None) -> Li
"descrpt_attr/ntypes",
"model_attr/tmap",
"model_attr/model_type",
"model_attr/model_version",
]

if model_type == "ener":
Expand All @@ -59,6 +60,7 @@ def _make_node_names(model_type: str, modifier_type: Optional[str] = None) -> Li
nodes += [
"o_wfc",
"model_attr/sel_type",
"model_attr/output_dim",
]
elif model_type == "dipole":
nodes += [
Expand All @@ -76,11 +78,13 @@ def _make_node_names(model_type: str, modifier_type: Optional[str] = None) -> Li
nodes += [
"o_polar",
"model_attr/sel_type",
"model_attr/output_dim",
]
elif model_type == "global_polar":
nodes += [
"o_global_polar",
"model_attr/sel_type",
"model_attr/output_dim",
]
else:
raise RuntimeError(f"unknow model type {model_type}")
Expand Down
4 changes: 2 additions & 2 deletions source/train/main.py → deepmd/entrypoints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@ def parse_args(args: Optional[List[str]] = None):
)
parser_tst.add_argument(
"-a",
"--atomic-energy",
"--atomic",
action="store_true",
default=False,
help="Test the accuracy of atomic energy",
help="Test the accuracy of atomic label, i.e. energy / dipole / polar",
)

# * compress model *****************************************************************
Expand Down
83 changes: 0 additions & 83 deletions deepmd/entrypoints/print_old_model.py

This file was deleted.

Loading

0 comments on commit 7feb3a4

Please sign in to comment.