FilesLast commitLast update
1 month ago
1 month ago
1 month ago
1 month ago
24 days ago
1 month ago
1 month ago
15 days ago
README

ProdEnvMatA

English | 简体中文

Product Support Status

Product Supported
Ascend 950PR&950DT √
Atlas A3 products √
Atlas A2 products √
Atlas 200I/500 A2 inference products ×
Atlas inference products ×
Atlas training products ×

Function Description

  • Operator function: prod_env_mat_a is the environment matrix computation operator of DeepMD-kit. It computes the SeA (Smoothed Angular) environment matrix descriptor of atoms. The computation consists of two major phases. The first phase is neighbor list formatting: computes interatomic distances, sorts them by type, and fills the neighbor list nlist in segments based on sel_a. The second phase is environment matrix computation: uses the spline5_switch quintic spline smoothing function to compute the 4-component descriptor and 12-component derivatives, and normalizes them with davg/dstd.

  • Computation formula:

For each central atom ii and its neighbor jj, the relative distance rij=∥rj−ri∥r_{ij}=\|\mathbf{r}_j-\mathbf{r}_i\| is computed. If rij≤rcut_rr_{ij} \leq r_{cut\_r}, the original 4-component descriptor is computed through the quintic spline smoothing function s=spline5_switch(rij,rcut_r_smth,rcut_r)s=\text{spline5\_switch}(r_{ij}, r_{cut\_r\_smth}, r_{cut\_r}):

dij=s⋅(1rij, rij,xrij2, rij,yrij2, rij,zrij2)\mathbf{d}_{ij} = s \cdot \left(\frac{1}{r_{ij}},\ \frac{r_{ij,x}}{r_{ij}^2},\ \frac{r_{ij,y}}{r_{ij}^2},\ \frac{r_{ij,z}}{r_{ij}^2}\right)

The normalized descriptor and derivatives are:

descrptij=dij−davgtidstdti,descrpt_derivij=vijdstdti\text{descrpt}_{ij} = \frac{\mathbf{d}_{ij} - \text{davg}_{t_i}}{\text{dstd}_{t_i}}, \quad \text{descrpt\_deriv}_{ij} = \frac{\mathbf{v}_{ij}}{\text{dstd}_{t_i}}

where tit_i is the type of the central atom ii, davgti\text{davg}_{t_i} and dstdti\text{dstd}_{t_i} are the mean and standard deviation corresponding to that type, and vij\mathbf{v}_{ij} is the derivative of the descriptor with respect to the coordinates of the central atom. If rij>rcut_rr_{ij} > r_{cut\_r}, s=0s=0, and the descriptor is −davg/dstd-\text{davg}/\text{dstd}.

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
coord Input 3D coordinates of all atoms. The shape is (nsample, nall*3), and the dimension must be 2. FLOAT ND
type Input Type indices of all atoms. The shape is (nsample, nall), the dimension must be 2, and shape[0] is the same as that of coord. INT32 ND
natoms Input Atom count information. The shape is (2+ntypes,), the dimension must be 1, and shape[0] ≥ 3. The value is [nloc, nall, ntype_0_count, ...]. In the infershape phase, natoms[0] is read to obtain nloc. INT32 ND
box Input Periodic boundary box (3×3 flattened). The shape is (nsample, 9). FLOAT ND
mesh Input Mesh information (used for replicating neighbors). The shape is (nsample, 6). INT32 ND
davg Input Descriptor mean (used for normalization). The shape is (ntypes, nnei*4), and the dimension must be 2. FLOAT ND
dstd Input Descriptor standard deviation (used for normalization). The shape is (ntypes, nnei*4), the dimension must be 2, the dtype is the same as that of coord/davg, and elements cannot be 0. FLOAT ND
descrpt Output Normalized environment matrix descriptor. The shape is (nsample, nloc*nnei*4). FLOAT ND
descrpt_deriv Output Descriptor derivatives. The shape is (nsample, nloc*nnei*12). FLOAT ND
rij Output Relative coordinates from the central atom to neighbors. The shape is (nsample, nloc*nnei*3). FLOAT ND
nlist Output Formatted neighbor list indices. The shape is (nsample, nloc*nnei), and the element value is ≥ -1 (-1 indicates no neighbor). INT32 ND
rcut_a Attribute Angular cutoff radius (currently unused, retained for compatibility), ≥ 0. Float -
rcut_r Attribute Radial cutoff radius, > 0 and ≥ rcut_r_smth. Float -
rcut_r_smth Attribute Smoothing start radius, > 0 and ≤ rcut_r. Float -
sel_a Attribute Number of angular neighbors selected for each type. It is a non-empty list, and elements are ≥ 0. nnei=sum(sel_a). ListInt -
sel_r Attribute Number of radial neighbors selected for each type (not used by this operator). Elements are ≥ 0. ListInt -

Constraint Description

  • coord is a 2-dimension tensor. The shape is (nsample, nall*3), and the dtype is float32.
  • type is a 2-dimension tensor. The shape is (nsample, nall), the dtype is int32, shape[0] is the same as coord.shape[0], and the element value is ≥ 0 (virtual atoms with type < 0 are skipped).
  • natoms is a 1-dimension tensor. The shape is (2+ntypes,), the dtype is int32, and shape[0] ≥ 3. natoms[0]=nloc (number of local atoms), natoms[1]=nall (total number of atoms), and the remaining elements are atom counts of each type.
  • box is a 2-dimension tensor. The shape is (nsample, 9), and the dtype is float32.
  • mesh is a 2-dimension tensor. The shape is (nsample, 6), and the dtype is int32.
  • davg is a 2-dimension tensor. The shape is (ntypes, nnei*4), the dtype is float32, and the dtype is the same as that of coord/dstd.
  • dstd is a 2-dimension tensor. The shape is (ntypes, nnei*4), the dtype is float32, the dtype is the same as that of coord/davg, and elements cannot be 0 (division denominator).
  • rcut_a must be ≥ 0.
  • rcut_r must be > 0 and ≥ rcut_r_smth.
  • rcut_r_smth must be > 0 and ≤ rcut_r.
  • sel_a must be a non-empty list, and all elements are ≥ 0. nnei=sum(sel_a) determines the second dimension of the output shape.
  • Elements of sel_r must be ≥ 0 (sel_r is not used by this operator and is retained for compatibility).
  • natoms[0] (nloc) determines the second dimension of the output shape. In the infershape phase, the natoms input is read through value dependency.
  • Output element values of nlist are ≥ -1, and -1 indicates no neighbor at the position (positions that are not filled are padded with -1).
  • Input tensors must have a contiguous memory layout (contiguous): that is, data is densely arranged in row-major order in memory, without stride hops or gaps (for the concept, see Non-contiguous Tensor). If a non-contiguous tensor (such as a view obtained by transpose or slicing) is passed in, the framework automatically makes it contiguous, which incurs additional copy overhead.
  • The operator supports only 2D inputs. Scalars, 1D, or 8D scenarios are not supported.

Invocation Description

Invocation Method Invocation Sample Description
Graph-mode invocation test_geir_prod_env_mat_a For operator compilation and verification, refer to Operator Invocation.