deepmd.dpmodel.descriptor.hybrid#
Classes#
Concatenate a list of descriptors to form a new descriptor. |
Module Contents#
- class deepmd.dpmodel.descriptor.hybrid.DescrptHybrid(list: DescrptHybrid.__init__.list[deepmd.dpmodel.descriptor.base_descriptor.BaseDescriptor | dict[str, Any]], type_map: DescrptHybrid.__init__.list[str] | None = None, ntypes: int | None = None)[source]#
Bases:
deepmd.dpmodel.descriptor.base_descriptor.BaseDescriptor,deepmd.dpmodel.common.NativeOPConcatenate a list of descriptors to form a new descriptor.
The hybrid descriptor combines multiple descriptors by concatenation:
\[\mathcal{D}^i = [\mathcal{D}^i_1, \mathcal{D}^i_2, ..., \mathcal{D}^i_n],\]where \(\mathcal{D}^i_k\) is the descriptor computed by the \(k\)-th sub-descriptor for atom \(i\).
The output dimension is the sum of all sub-descriptor dimensions:
\[\dim(\mathcal{D}^i) = \sum_{k=1}^{n} \dim(\mathcal{D}^i_k).\]- Parameters:
- get_rcut_smth() float[source]#
Returns the radius where the neighbor information starts to smoothly decay to 0.
- mixed_types() bool[source]#
Returns if the descriptor requires a neighbor list that distinguish different atomic types or not.
- need_sorted_nlist_for_lower() bool[source]#
Returns whether the descriptor needs sorted nlist when using forward_lower.
- get_env_protection() float[source]#
Returns the protection of building environment matrix. All descriptors should be the same.
Share the parameters of self to the base_class with shared_level during multitask training. If not start from checkpoint (resume is False), some separated parameters (e.g. mean and stddev) will be re-calculated across different classes.
- change_type_map(type_map: list[str], model_with_new_type_stat: Any = None) None[source]#
Change the type related params to new ones, according to type_map and the original one in the model. If there are new types in type_map, statistics will be updated accordingly to model_with_new_type_stat for these new types.
- compute_input_stats(merged: list[dict], path: deepmd.utils.path.DPPath | None = None) None[source]#
Update mean and stddev for descriptor elements.
- set_stat_mean_and_stddev(mean: list[numpy.ndarray | list[deepmd.dpmodel.array_api.Array]], stddev: list[numpy.ndarray | list[deepmd.dpmodel.array_api.Array]]) None[source]#
Update mean and stddev for descriptor.
- get_stat_mean_and_stddev() tuple[list[deepmd.dpmodel.array_api.Array | list[deepmd.dpmodel.array_api.Array]], list[deepmd.dpmodel.array_api.Array | list[deepmd.dpmodel.array_api.Array]]][source]#
Get mean and stddev for descriptor.
- enable_compression(min_nbor_dist: float, table_extrapolate: float = 5, table_stride_1: float = 0.01, table_stride_2: float = 0.1, check_frequency: int = -1) None[source]#
Receive the statistics (distance, max_nbor_size and env_mat_range) of the training data.
- Parameters:
- min_nbor_dist
The nearest distance between atoms
- table_extrapolate
The scale of model extrapolation
- table_stride_1
The uniform stride of the first table
- table_stride_2
The uniform stride of the second table
- check_frequency
The overflow check frequency
- call(coord_ext: deepmd.dpmodel.array_api.Array, atype_ext: deepmd.dpmodel.array_api.Array, nlist: deepmd.dpmodel.array_api.Array, mapping: deepmd.dpmodel.array_api.Array | None = None, fparam: deepmd.dpmodel.array_api.Array | None = None) tuple[deepmd.dpmodel.array_api.Array, deepmd.dpmodel.array_api.Array | None, deepmd.dpmodel.array_api.Array | None, deepmd.dpmodel.array_api.Array | None, deepmd.dpmodel.array_api.Array | None][source]#
Compute the descriptor.
- Parameters:
- coord_ext
The extended coordinates of atoms. shape: nf x (nallx3)
- atype_ext
The extended aotm types. shape: nf x nall
- nlist
The neighbor list. shape: nf x nloc x nnei
- mapping
The index mapping, not required by this descriptor.
- Returns:
descriptorThe descriptor. shape: nf x nloc x (ng x axis_neuron)
grThe rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3.
g2The rotationally invariant pair-partical representation.
h2The rotationally equivariant pair-partical representation.
swThe smooth switch function.
- classmethod update_sel(train_data: deepmd.utils.data_system.DeepmdDataSystem, type_map: list[str] | None, local_jdata: dict) tuple[deepmd.dpmodel.array_api.Array, deepmd.dpmodel.array_api.Array][source]#
Update the selection and perform neighbor statistics.
- classmethod deserialize(data: dict) DescrptHybrid[source]#
Deserialize the model.
- Parameters:
- data
dict The serialized data
- data
- Returns:
BDThe deserialized descriptor