-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1177 from deepmodeling/devel
Merge recent development on devel into master
- Loading branch information
Showing
86 changed files
with
25,686 additions
and
11,619 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,11 +8,12 @@ concurrency: | |
|
||
jobs: | ||
git-mirror: | ||
if: github.repository_owner == 'deepmodeling' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: wearerequired/git-mirror-action@v1 | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.SYNC_GITEE_PRIVATE_KEY }} | ||
with: | ||
source-repo: "git@github.com:deepmodeling/deepmd-kit.git" | ||
source-repo: "https://github.com/deepmodeling/deepmd-kit.git" | ||
destination-repo: "[email protected]:deepmodeling/deepmd-kit.git" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,6 @@ API_CC | |
doc/api_py/ | ||
dp/ | ||
build_lammps/ | ||
.idea/ | ||
build_tests/ | ||
build_cc_tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
version: 2 | ||
conda: | ||
environment: doc/environment.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
from typing import Tuple, List | ||
|
||
from deepmd.env import tf | ||
from deepmd.utils.graph import get_embedding_net_variables | ||
from .descriptor import Descriptor | ||
|
||
|
||
class DescrptSe (Descriptor): | ||
"""A base class for smooth version of descriptors. | ||
Notes | ||
----- | ||
All of these descriptors have an environmental matrix and an | ||
embedding network (:meth:`deepmd.utils.network.embedding_net`), so | ||
they can share some similiar methods without defining them twice. | ||
Attributes | ||
---------- | ||
embedding_net_variables : dict | ||
initial embedding network variables | ||
descrpt_reshape : tf.Tensor | ||
the reshaped descriptor | ||
descrpt_deriv : tf.Tensor | ||
the descriptor derivative | ||
rij : tf.Tensor | ||
distances between two atoms | ||
nlist : tf.Tensor | ||
the neighbor list | ||
""" | ||
def _identity_tensors(self, suffix : str = "") -> None: | ||
"""Identify tensors which are expected to be stored and restored. | ||
Notes | ||
----- | ||
These tensors will be indentitied: | ||
self.descrpt_reshape : o_rmat | ||
self.descrpt_deriv : o_rmat_deriv | ||
self.rij : o_rij | ||
self.nlist : o_nlist | ||
Thus, this method should be called during building the descriptor and | ||
after these tensors are initialized. | ||
Parameters | ||
---------- | ||
suffix : str | ||
The suffix of the scope | ||
""" | ||
self.descrpt_reshape = tf.identity(self.descrpt_reshape, name = 'o_rmat' + suffix) | ||
self.descrpt_deriv = tf.identity(self.descrpt_deriv, name = 'o_rmat_deriv' + suffix) | ||
self.rij = tf.identity(self.rij, name = 'o_rij' + suffix) | ||
self.nlist = tf.identity(self.nlist, name = 'o_nlist' + suffix) | ||
|
||
def get_tensor_names(self, suffix : str = "") -> Tuple[str]: | ||
"""Get names of tensors. | ||
Parameters | ||
---------- | ||
suffix : str | ||
The suffix of the scope | ||
Returns | ||
------- | ||
Tuple[str] | ||
Names of tensors | ||
""" | ||
return (f'o_rmat{suffix}:0', f'o_rmat_deriv{suffix}:0', f'o_rij{suffix}:0', f'o_nlist{suffix}:0') | ||
|
||
def pass_tensors_from_frz_model(self, | ||
descrpt_reshape : tf.Tensor, | ||
descrpt_deriv : tf.Tensor, | ||
rij : tf.Tensor, | ||
nlist : tf.Tensor | ||
): | ||
""" | ||
Pass the descrpt_reshape tensor as well as descrpt_deriv tensor from the frz graph_def | ||
Parameters | ||
---------- | ||
descrpt_reshape | ||
The passed descrpt_reshape tensor | ||
descrpt_deriv | ||
The passed descrpt_deriv tensor | ||
rij | ||
The passed rij tensor | ||
nlist | ||
The passed nlist tensor | ||
""" | ||
self.rij = rij | ||
self.nlist = nlist | ||
self.descrpt_deriv = descrpt_deriv | ||
self.descrpt_reshape = descrpt_reshape | ||
|
||
def init_variables(self, | ||
model_file : str, | ||
suffix : str = "", | ||
) -> None: | ||
""" | ||
Init the embedding net variables with the given dict | ||
Parameters | ||
---------- | ||
model_file : str | ||
The input frozen model file | ||
suffix : str, optional | ||
The suffix of the scope | ||
""" | ||
self.embedding_net_variables = get_embedding_net_variables(model_file, suffix = suffix) |
Oops, something went wrong.