deepmd.dpmodel.descriptor.hybrid#

Classes#

DescrptHybrid

Concate 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.NativeOP

Concate a list of descriptors to form a new descriptor.

Parameters:
listlistlist[Union[BaseDescriptor, dict[str, Any]]]

Build a descriptor from the concatenation of the list of descriptors. The descriptor can be either an object or a dictionary.

descrpt_list[source]#
numb_descrpt[source]#
nlist_cut_idx[source]#
get_rcut() float[source]#

Returns the cut-off radius.

get_rcut_smth() float[source]#

Returns the radius where the neighbor information starts to smoothly decay to 0.

get_sel() list[int][source]#

Returns the number of selected atoms for each type.

get_ntypes() int[source]#

Returns the number of element types.

get_type_map() list[str][source]#

Get the name to each type of atoms.

get_dim_out() int[source]#

Returns the output dimension.

get_dim_emb() int[source]#

Returns the output dimension.

mixed_types()[source]#

Returns if the descriptor requires a neighbor list that distinguish different atomic types or not.

has_message_passing() bool[source]#

Returns whether the descriptor has message passing.

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.

abstract share_params(base_class, shared_level, resume=False) NoReturn[source]#

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=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[numpy.ndarray]], stddev: list[numpy.ndarray | list[numpy.ndarray]]) None[source]#

Update mean and stddev for descriptor.

get_stat_mean_and_stddev() tuple[list[numpy.ndarray | list[numpy.ndarray]], list[numpy.ndarray | list[numpy.ndarray]]][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 statisitcs (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, atype_ext, nlist, mapping: numpy.ndarray | None = 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:
descriptor

The descriptor. shape: nf x nloc x (ng x axis_neuron)

gr

The rotationally equivariant and permutationally invariant single particle representation. shape: nf x nloc x ng x 3.

g2

The rotationally invariant pair-partical representation.

h2

The rotationally equivariant pair-partical representation.

sw

The smooth switch function.

classmethod update_sel(train_data: deepmd.utils.data_system.DeepmdDataSystem, type_map: list[str] | None, local_jdata: dict) tuple[dict, float | None][source]#

Update the selection and perform neighbor statistics.

Parameters:
train_dataDeepmdDataSystem

data used to do neighbor statistics

type_maplist[str], optional

The name of each type of atoms

local_jdatadict

The local data refer to the current class

Returns:
dict

The updated local data

float

The minimum distance between two atoms

serialize() dict[source]#

Serialize the obj to dict.

classmethod deserialize(data: dict) DescrptHybrid[source]#

Deserialize the model.

Parameters:
datadict

The serialized data

Returns:
BD

The deserialized descriptor