2525
2626
2727class DescrptSeA (NativeOP ):
28+ r"""DeepPot-SE constructed from all information (both angular and radial) of
29+ atomic configurations. The embedding takes the distance between atoms as input.
30+
31+ The descriptor :math:`\mathcal{D}^i \in \mathcal{R}^{M_1 \times M_2}` is given by [1]_
32+
33+ .. math::
34+ \mathcal{D}^i = (\mathcal{G}^i)^T \mathcal{R}^i (\mathcal{R}^i)^T \mathcal{G}^i_<
35+
36+ where :math:`\mathcal{R}^i \in \mathbb{R}^{N \times 4}` is the coordinate
37+ matrix, and each row of :math:`\mathcal{R}^i` can be constructed as follows
38+
39+ .. math::
40+ (\mathcal{R}^i)_j = [
41+ \begin{array}{c}
42+ s(r_{ji}) & \frac{s(r_{ji})x_{ji}}{r_{ji}} & \frac{s(r_{ji})y_{ji}}{r_{ji}} & \frac{s(r_{ji})z_{ji}}{r_{ji}}
43+ \end{array}
44+ ]
45+
46+ where :math:`\mathbf{R}_{ji}=\mathbf{R}_j-\mathbf{R}_i = (x_{ji}, y_{ji}, z_{ji})` is
47+ the relative coordinate and :math:`r_{ji}=\lVert \mathbf{R}_{ji} \lVert` is its norm.
48+ The switching function :math:`s(r)` is defined as:
49+
50+ .. math::
51+ s(r)=
52+ \begin{cases}
53+ \frac{1}{r}, & r<r_s \\
54+ \frac{1}{r} \{ {(\frac{r - r_s}{ r_c - r_s})}^3 (-6 {(\frac{r - r_s}{ r_c - r_s})}^2 +15 \frac{r - r_s}{ r_c - r_s} -10) +1 \}, & r_s \leq r<r_c \\
55+ 0, & r \geq r_c
56+ \end{cases}
57+
58+ Each row of the embedding matrix :math:`\mathcal{G}^i \in \mathbb{R}^{N \times M_1}` consists of outputs
59+ of a embedding network :math:`\mathcal{N}` of :math:`s(r_{ji})`:
60+
61+ .. math::
62+ (\mathcal{G}^i)_j = \mathcal{N}(s(r_{ji}))
63+
64+ :math:`\mathcal{G}^i_< \in \mathbb{R}^{N \times M_2}` takes first :math:`M_2` columns of
65+ :math:`\mathcal{G}^i`. The equation of embedding network :math:`\mathcal{N}` can be found at
66+ :meth:`deepmd.utils.network.embedding_net`.
67+
68+ Parameters
69+ ----------
70+ rcut
71+ The cut-off radius :math:`r_c`
72+ rcut_smth
73+ From where the environment matrix should be smoothed :math:`r_s`
74+ sel : list[str]
75+ sel[i] specifies the maxmum number of type i atoms in the cut-off radius
76+ neuron : list[int]
77+ Number of neurons in each hidden layers of the embedding net :math:`\mathcal{N}`
78+ axis_neuron
79+ Number of the axis neuron :math:`M_2` (number of columns of the sub-matrix of the embedding matrix)
80+ resnet_dt
81+ Time-step `dt` in the resnet construction:
82+ y = x + dt * \phi (Wx + b)
83+ trainable
84+ If the weights of embedding net are trainable.
85+ type_one_side
86+ Try to build N_types embedding nets. Otherwise, building N_types^2 embedding nets
87+ exclude_types : List[List[int]]
88+ The excluded pairs of types which have no interaction with each other.
89+ For example, `[[0, 1]]` means no interaction between type 0 and type 1.
90+ set_davg_zero
91+ Set the shift of embedding net input to zero.
92+ activation_function
93+ The activation function in the embedding net. Supported options are |ACTIVATION_FN|
94+ precision
95+ The precision of the embedding net parameters. Supported options are |PRECISION|
96+ multi_task
97+ If the model has multi fitting nets to train.
98+ spin
99+ The deepspin object.
100+
101+ Limitations
102+ -----------
103+ The currently implementation does not support the following features
104+
105+ 1. type_one_side == False
106+ 2. exclude_types != []
107+ 3. spin is not None
108+
109+ References
110+ ----------
111+ .. [1] Linfeng Zhang, Jiequn Han, Han Wang, Wissam A. Saidi, Roberto Car, and E. Weinan. 2018.
112+ End-to-end symmetry preserving inter-atomic potential energy model for finite and extended
113+ systems. In Proceedings of the 32nd International Conference on Neural Information Processing
114+ Systems (NIPS'18). Curran Associates Inc., Red Hook, NY, USA, 4441-4451.
115+ """
116+
28117 def __init__ (
29118 self ,
30119 rcut : float ,
@@ -40,13 +129,10 @@ def __init__(
40129 activation_function : str = "tanh" ,
41130 precision : str = DEFAULT_PRECISION ,
42131 spin : Optional [Any ] = None ,
43- stripped_type_embedding : bool = False ,
44132 ) -> None :
45133 ## seed, uniform_seed, multi_task, not included.
46134 if not type_one_side :
47135 raise NotImplementedError ("type_one_side == False not implemented" )
48- if stripped_type_embedding :
49- raise NotImplementedError ("stripped_type_embedding is not implemented" )
50136 if exclude_types != []:
51137 raise NotImplementedError ("exclude_types is not implemented" )
52138 if spin is not None :
@@ -66,7 +152,6 @@ def __init__(
66152 self .activation_function = activation_function
67153 self .precision = precision
68154 self .spin = spin
69- self .stripped_type_embedding = stripped_type_embedding
70155
71156 in_dim = 1 # not considiering type embedding
72157 self .embeddings = []
@@ -120,7 +205,7 @@ def call(
120205 atype_ext ,
121206 nlist ,
122207 ):
123- """Compute the environment matrix .
208+ """Compute the descriptor .
124209
125210 Parameters
126211 ----------
@@ -172,7 +257,6 @@ def serialize(self) -> dict:
172257 "activation_function" : self .activation_function ,
173258 "precision" : self .precision ,
174259 "spin" : self .spin ,
175- "stripped_type_embedding" : self .stripped_type_embedding ,
176260 "env_mat" : self .env_mat .serialize (),
177261 "embeddings" : [ii .serialize () for ii in self .embeddings ],
178262 "@variables" : {
0 commit comments