deepmd.tf.nvnmd.entrypoints#
Submodules#
Classes#
Functions#
| Save the dictionary of weight to a npy file. |
Package Contents#
- deepmd.tf.nvnmd.entrypoints.save_weight(sess: deepmd.tf.env.tf.Session, file_name: str = 'nvnmd/weight.npy') None[source]#
Save the dictionary of weight to a npy file.
- class deepmd.tf.nvnmd.entrypoints.MapTable(config_file: str, weight_file: str, map_file: str)[source]#
Generate the mapping table describing the relastionship of atomic distance, cutoff function, and embedding matrix.
three mapping table will be built:
\(r^2_{ji} \rightarrow s_{ji}\)\(r^2_{ji} \rightarrow h_{ji}\)\(r^2_{ji} \rightarrow \mathcal{G}_{ji}\)where \(s_{ji}\) is cut-off function, \(h_{ji} = \frac{s(r_{ji})}{r_{ji}}\), and \(\mathcal{G}_{ji}\) is embedding matrix.
The mapping function can be define as:
\(y = f(x) = y_{k} + (x - x_{k}) * dy_{k}\)\(y_{k} = f(x_{k})\)\(dy_{k} = \frac{f(x_{k+1}) - f(x_{k})}{dx}\)\(x_{k} \leq x < x_{k+1}\)\(x_{k} = k * dx\)where \(dx\) is interpolation interval.
- Parameters:
- config_file
input file name an .npy file containing the configuration information of NVNMD model
- weight_file
input file name an .npy file containing the weights of NVNMD model
- map_file
output file name an .npy file containing the mapping tables of NVNMD model
References
DOI: 10.1038/s41524-022-00773-z
- config_file#
- weight_file#
- map_file#
- Gs_Gt_mode = 1#
- mapping(x: numpy.ndarray, dic_map: dict, cfgs: dict) dict[source]#
Evaluate value by mapping table operation of tensorflow.
- mapping2(x: numpy.ndarray, dic_map: dict, cfgs: dict) dict[source]#
Evaluate value by mapping table of numpy.
- plot_lines(x: numpy.ndarray, dic1: dict, dic2: dict | None = None) None[source]#
Plot lines to see accuracy.
- build_map_coef(cfgs: list, x: numpy.ndarray, ys: numpy.ndarray, grads: numpy.ndarray, grad_grads: numpy.ndarray, Nr: int, Nc: int) tuple[numpy.ndarray, numpy.ndarray][source]#
Build mapping table coefficient cfgs: cfg list cfg = x0, x1, dx.
coef4: a x^3 + b x^2 + c x + d = y: / d = y0 | c = y0’ | b = (3 y1 - dx dy’ - 2dx y0’ - 3y0) / dx^2 a = (dx y1’ - 2 y1 + dx y0’ + 2 y0) / dx^3
- cal_coef4(cfgs: list, x: numpy.ndarray, y: numpy.ndarray, dy: numpy.ndarray) numpy.ndarray[source]#
Build mapping table coefficient for one line coef4: a x^3 + b x^2 + c x + d = y: / d = y0 | c = y0’ | b = (3 y1 - dx dy’ - 2dx y0’ - 3y0) / dx^2 a = (dx y1’ - 2 y1 + dx y0’ + 2 y0) / dx^3.
- build_grad(x: Any, y: Any, Nr: int, Nc: int) tuple[Any, Any][source]#
: Build gradient of tensor y of x.
- build_s2g(s: deepmd.tf.env.tf.Tensor) deepmd.tf.env.tf.Tensor[source]#
Build s->G s is switch function G is embedding net output.
- build_t2g() dict[source]#
Build t->G t is chemical species of center atom and neighbor atom G is embedding net output of type.
- class deepmd.tf.nvnmd.entrypoints.Wrap(config_file: str, weight_file: str, map_file: str, model_file: str)[source]#
Generate the binary model file (model.pb).
the model file can be use to run the NVNMD with lammps the pair style need set as:
pair_style nvnmd model.pb pair_coeff * *
- Parameters:
- config_file
input file name an .npy file containing the configuration information of NVNMD model
- weight_file
input file name an .npy file containing the weights of NVNMD model
- map_file
input file name an .npy file containing the mapping tables of NVNMD model
- model_file
output file name an .pb file containing the model using in the NVNMD
References
DOI: 10.1038/s41524-022-00773-z
- config_file#
- weight_file#
- map_file#
- model_file#
- wrap_head(nhs: Any, nws: Any) Any[source]#
Wrap the head information.
version nhead nheight nwidth rcut cut-off radius ntype number of atomic species nnei number of neighbors atom_ener atom bias energy ener_fact factor for atom_ener
- wrap_dscp() str[source]#
Wrap the configuration of descriptor.
version 0: [NBIT_IDX_S2G-1:0] SHIFT_IDX_S2G
[NBIT_NEIB*NTYPE-1:0] SELs [NBIT_FIXD*M1*NTYPE*NTYPE-1:0] GSs [NBIT_FLTE-1:0] NEXPO_DIV_NI
version 1:
[NBIT_FLTE-1:0] NEXPO_DIV_NI
- wrap_weight(weight: numpy.ndarray, NBIT_DISP: int, NBIT_WEIGHT: int) tuple[list[str], list[str], list[list[str]], list[list[str]]][source]#
weight: weights of fittingNet NBIT_DISP: nbits of exponent of weight max value NBIT_WEIGHT: nbits of mantissa of weights.