From 24b433b20e51fc45c7ae587104d00cf732b0e92a Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 22 Aug 2021 21:49:35 -0400 Subject: [PATCH 1/2] add docstring to `DescrptSeA` Contains other cleanups. --- deepmd/descriptor/loc_frame.py | 2 +- deepmd/descriptor/se_a.py | 60 +++++++++++++++++++++++++++++----- deepmd/descriptor/se_a_ef.py | 2 +- deepmd/descriptor/se_r.py | 2 +- deepmd/descriptor/se_t.py | 2 +- deepmd/infer/deep_eval.py | 4 +-- deepmd/utils/network.py | 39 +++++++++++++++++++--- 7 files changed, 92 insertions(+), 19 deletions(-) diff --git a/deepmd/descriptor/loc_frame.py b/deepmd/descriptor/loc_frame.py index 2f778b2049..be57403d60 100644 --- a/deepmd/descriptor/loc_frame.py +++ b/deepmd/descriptor/loc_frame.py @@ -292,7 +292,7 @@ def prod_force_virial(self, natoms[i]: 2 <= i < Ntypes+2, number of type i atoms Returns - ------ + ------- force The force on atoms virial diff --git a/deepmd/descriptor/se_a.py b/deepmd/descriptor/se_a.py index d6d3a0dc31..d75ec7c995 100644 --- a/deepmd/descriptor/se_a.py +++ b/deepmd/descriptor/se_a.py @@ -16,23 +16,58 @@ from deepmd.utils.graph import load_graph_def, get_tensor_by_name_from_graph class DescrptSeA (): - """DeepPot-SE constructed from all information (both angular and radial) of - atomic configurations. - - The embedding takes the distance between atoms as input. + r"""DeepPot-SE constructed from all information (both angular and radial) of + atomic configurations. The embedding takes the distance between atoms as input. + + The descriptor :math:`\mathcal{D}^i \in \mathcal{R}^{M_1 \times M_2}` is given by [1]_ + + .. math:: + \mathcal{D}^i = (\mathcal{G}^i)^T \mathcal{R}^i (\mathcal{R}^i)^T \mathcal{G}^i_< + + where :math:`\mathcal{R}^i \in \mathbb{R}^{N \times 4}` is the coordinate + matrix, and each row of :math:`\mathcal{R}^i` can be constructed as follows + + .. math:: + (\mathcal{R}^i)_j = [ + \begin{array}{c} + s(r_{ji}) & x_{ji} & y_{ji} & z_{ji} + \end{array} + ] + + where :math:`\mathbf{R}_{ji}=\mathbf{R}_j-\mathbf{R}_i = (x_{ji}, y_{ji}, z_{ji})` is + the relative coordinate and :math:`r_{ji}=\lVert \mathbf{R}_{ji} \lVert` is its norm. + The switching function :math:`s(r)` is defined as: + + .. math:: + s(r)= + \begin{cases} + \frac{1}{r}, & r