deepmd.tf.descriptor.se_t#
Classes#
DeepPot-SE constructed from all information (both angular and radial) of atomic |
Module Contents#
- class deepmd.tf.descriptor.se_t.DescrptSeT(rcut: float, rcut_smth: float, sel: list[int], neuron: list[int] = [24, 48, 96], resnet_dt: bool = False, trainable: bool = True, seed: int | None = None, exclude_types: list[list[int]] = [], set_davg_zero: bool = False, activation_function: str = 'tanh', precision: str = 'default', uniform_seed: bool = False, type_map: list[str] | None = None, env_protection: float = 0.0, **kwargs)[source]#
Bases:
deepmd.tf.descriptor.se.DescrptSeDeepPot-SE constructed from all information (both angular and radial) of atomic configurations.
The embedding takes angles between two neighboring atoms as input.
- Parameters:
- rcut
The cut-off radius
- rcut_smth
From where the environment matrix should be smoothed
- sel
list[int] sel[i] specifies the maxmum number of type i atoms in the cut-off radius
- neuron
list[int] Number of neurons in each hidden layers of the embedding net
- resnet_dt
Time-step dt in the resnet construction: y = x + dt * phi (Wx + b)
- trainable
If the weights of embedding net are trainable.
- seed
Random seed for initializing the network parameters.
- set_davg_zero
Set the shift of embedding net input to zero.
- activation_function
The activation function in the embedding net. Supported options are “relu”, “linear”, “tanh”, “sigmoid”, “gelu_tf”, “gelu”, “none”, “softplus”, “relu6”.
- precision
The precision of the embedding net parameters. Supported options are “default”, “float32”, “float64”, “float16”.
- uniform_seed
Only for the purpose of backward compatibility, retrieves the old behavior of using the random seed
- env_protection: float
Protection parameter to prevent division by zero errors during environment matrix calculations.
- type_map: list[str], Optional
A list of strings. Give the name to each type of atoms.
- get_nlist() tuple[deepmd.tf.env.tf.Tensor, deepmd.tf.env.tf.Tensor, list[int], list[int]][source]#
Returns neighbor information.
- compute_input_stats(data_coord: list, data_box: list, data_atype: list, natoms_vec: list, mesh: list, input_dict: dict, **kwargs) None[source]#
Compute the statisitcs (avg and std) of the training data. The input will be normalized by the statistics.
- Parameters:
- data_coord
The coordinates. Can be generated by deepmd.tf.model.make_stat_input
- data_box
The box. Can be generated by deepmd.tf.model.make_stat_input
- data_atype
The atom types. Can be generated by deepmd.tf.model.make_stat_input
- natoms_vec
The vector for the number of atoms of the system and different types of atoms. Can be generated by deepmd.tf.model.make_stat_input
- mesh
The mesh for neighbor searching. Can be generated by deepmd.tf.model.make_stat_input
- input_dict
Dictionary for additional input
- **kwargs
Additional keyword arguments.
- merge_input_stats(stat_dict) None[source]#
Merge the statisitcs computed from compute_input_stats to obtain the self.davg and self.dstd.
- Parameters:
- stat_dict
The dict of statisitcs computed from compute_input_stats, including:
- sumr
The sum of radial statisitcs.
- suma
The sum of relative coord statisitcs.
- sumn
The sum of neighbor numbers.
- sumr2
The sum of square of radial statisitcs.
- suma2
The sum of square of relative coord statisitcs.
- enable_compression(min_nbor_dist: float, graph: deepmd.tf.env.tf.Graph, graph_def: deepmd.tf.env.tf.GraphDef, table_extrapolate: float = 5, table_stride_1: float = 0.01, table_stride_2: float = 0.1, check_frequency: int = -1, suffix: str = '') 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
- graph
tf.Graph The graph of the model
- graph_def
tf.GraphDef The graph_def of the model
- 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
- suffix
str,optional The suffix of the scope
- build(coord_: deepmd.tf.env.tf.Tensor, atype_: deepmd.tf.env.tf.Tensor, natoms: deepmd.tf.env.tf.Tensor, box_: deepmd.tf.env.tf.Tensor, mesh: deepmd.tf.env.tf.Tensor, input_dict: dict, reuse: bool | None = None, suffix: str = '') deepmd.tf.env.tf.Tensor[source]#
Build the computational graph for the descriptor.
- Parameters:
- coord_
The coordinate of atoms
- atype_
The type of atoms
- natoms
The number of atoms. This tensor has the length of Ntypes + 2 natoms[0]: number of local atoms natoms[1]: total number of atoms held by this processor natoms[i]: 2 <= i < Ntypes+2, number of type i atoms
- box_
tf.Tensor The box of the system
- mesh
For historical reasons, only the length of the Tensor matters. if size of mesh == 6, pbc is assumed. if size of mesh == 0, no-pbc is assumed.
- input_dict
Dictionary for additional inputs
- reuse
The weights in the networks should be reused when get the variable.
- suffix
Name suffix to identify this descriptor
- Returns:
descriptorThe output descriptor
- prod_force_virial(atom_ener: deepmd.tf.env.tf.Tensor, natoms: deepmd.tf.env.tf.Tensor) tuple[deepmd.tf.env.tf.Tensor, deepmd.tf.env.tf.Tensor, deepmd.tf.env.tf.Tensor][source]#
Compute force and virial.
- Parameters:
- atom_ener
The atomic energy
- natoms
The number of atoms. This tensor has the length of Ntypes + 2 natoms[0]: number of local atoms natoms[1]: total number of atoms held by this processor natoms[i]: 2 <= i < Ntypes+2, number of type i atoms
- Returns:
forceThe force on atoms
virialThe total virial
atom_virialThe atomic virial
- _filter(inputs, type_input, natoms, activation_fn=tf.nn.tanh, stddev=1.0, bavg=0.0, name='linear', reuse=None, trainable=True)[source]#
- serialize_network(ntypes: int, ndim: int, in_dim: int, neuron: list[int], activation_function: str, resnet_dt: bool, variables: dict, excluded_types: set[tuple[int, int]] = set(), suffix: str = '') dict[source]#
Serialize network.
- Parameters:
- ntypes
int The number of types
- ndim
int The dimension of elements
- in_dim
int The input dimension
- neuron
list[int] The neuron list
- activation_function
str The activation function
- resnet_dtbool
Whether to use resnet
- variables
dict The input variables
- excluded_types
set[tuple[int,int]],optional The excluded types
- suffix
str,optional The suffix of the scope
- ntypes
- Returns:
dictThe converted network data