deepmd.tf.fit.dipole#
Classes#
Fit the atomic dipole with descriptor se_a. |
Module Contents#
- class deepmd.tf.fit.dipole.DipoleFittingSeA(ntypes: int, dim_descrpt: int, embedding_width: int, neuron: list[int] = [120, 120, 120], resnet_dt: bool = True, numb_fparam: int = 0, numb_aparam: int = 0, dim_case_embd: int = 0, sel_type: list[int] | None = None, seed: int | None = None, activation_function: str = 'tanh', precision: str = 'default', uniform_seed: bool = False, mixed_types: bool = False, type_map: list[str] | None = None, default_fparam: list[float] | None = None, trainable: list[bool] | None = None, **kwargs: Any)[source]#
Bases:
deepmd.tf.fit.fitting.FittingFit the atomic dipole with descriptor se_a.
- Parameters:
- ntypes
The ntypes of the descriptor \(\mathcal{D}\)
- dim_descrpt
The dimension of the descriptor \(\mathcal{D}\)
- embedding_width
The rotation matrix dimension of the descriptor \(\mathcal{D}\)
- neuron
list[int] Number of neurons in each hidden layer of the fitting net
- resnet_dtbool
Time-step dt in the resnet construction: y = x + dt * phi (Wx + b)
- numb_fparam
Number of frame parameters
- numb_aparam
Number of atomic parameters
- dim_case_embd
Dimension of case specific embedding.
- sel_type
list[int] The atom types selected to have an atomic dipole prediction. If is None, all atoms are selected.
- seed
int Random seed for initializing the network parameters.
- activation_function
str The activation function in the embedding net. Supported options are “relu6”, “sigmoid”, “none”, “tanh”, “silut”, “gelu”, “linear”, “relu”, “softplus”, “silu”, “gelu_tf”.
- precision
str The precision of the embedding net parameters. Supported options are “float16”, “default”, “bfloat16”, “float64”, “float32”.
- uniform_seed
Only for the purpose of backward compatibility, retrieves the old behavior of using the random seed
- mixed_typesbool
If true, use a uniform fitting net for all atom types, otherwise use different fitting nets for different atom types.
- type_map: list[str], Optional
A list of strings. Give the name to each type of atoms.
- default_fparam: list[float], optional
The default frame parameter. If set, when fparam.npy files are not included in the data system, this value will be used as the default value for the frame parameter in the fitting net.
- trainable
list[bool],Optional If the weights of fitting net are trainable. Suppose that we have \(N_l\) hidden layers in the fitting net, this list is of length \(N_l + 1\), specifying if the hidden layers and the output layer are trainable.
- _build_lower(start_index: int, natoms: int, inputs: deepmd.tf.env.tf.Tensor, rot_mat: deepmd.tf.env.tf.Tensor, suffix: str = '', reuse: bool | None = None) deepmd.tf.env.tf.Tensor[source]#
- build(input_d: deepmd.tf.env.tf.Tensor, rot_mat: deepmd.tf.env.tf.Tensor, natoms: deepmd.tf.env.tf.Tensor, input_dict: dict | None = None, reuse: bool | None = None, suffix: str = '') deepmd.tf.env.tf.Tensor[source]#
Build the computational graph for fitting net.
- Parameters:
- input_d
The input descriptor
- rot_mat
The rotation matrix from the descriptor.
- 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
- input_dict
Additional dict for inputs.
- reuse
The weights in the networks should be reused when get the variable.
- suffix
Name suffix to identify this descriptor
- Returns:
dipoleThe atomic dipole.
- init_variables(graph: deepmd.tf.env.tf.Graph, graph_def: deepmd.tf.env.tf.GraphDef, suffix: str = '') None[source]#
Init the fitting net variables with the given dict.
- enable_mixed_precision(mixed_prec: dict | None = None) None[source]#
Receive the mixed precision setting.
- Parameters:
- mixed_prec
The mixed precision setting used in the embedding net
- get_loss(loss: dict, lr: deepmd.tf.utils.learning_rate.LearningRateExp) deepmd.tf.loss.loss.Loss[source]#
Get the loss function.
- Parameters:
- loss
dict the loss dict
- lr
LearningRateSchedule the learning rate
- loss
- Returns:
Lossthe loss function
- classmethod deserialize(data: dict, suffix: str) DipoleFittingSeA[source]#
Deserialize the model.
- Parameters:
- data
dict The serialized data
- data
- Returns:
ModelThe deserialized model
- property input_requirement: list[deepmd.utils.data.DataRequirementItem][source]#
Return data requirements needed for the model input.