deepmd.tf.descriptor.se_a_ef#
Classes#
Smooth edition descriptor with Ef. | |
Helper class for implementing DescrptSeAEf. |
Module Contents#
- class deepmd.tf.descriptor.se_a_ef.DescrptSeAEf(rcut: float, rcut_smth: float, sel: list[int], neuron: list[int] = [24, 48, 96], axis_neuron: int = 8, resnet_dt: bool = False, trainable: bool = True, seed: int | None = None, type_one_side: bool = True, exclude_types: list[list[int]] = [], set_davg_zero: bool = False, activation_function: str = 'tanh', precision: str = 'default', uniform_seed: bool = False, **kwargs: Any)[source]#
Bases:
deepmd.tf.descriptor.se.DescrptSeSmooth edition descriptor with Ef.
- 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
- axis_neuron
Number of the axis neuron (number of columns of the sub-matrix of the embedding matrix)
- 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.
- type_one_side
Try to build N_types embedding nets. Otherwise, building N_types^2 embedding nets
- exclude_types
list[list[int]] The excluded pairs of types which have no interaction with each other. For example, [[0, 1]] means no interaction between type 0 and type 1.
- set_davg_zero
Set the shift of embedding net input to zero.
- activation_function
The activation function in the embedding net. Supported options are “gelu”, “gelu_tf”, “relu”, “silut”, “none”, “silu”, “tanh”, “softplus”, “sigmoid”, “linear”, “relu6”.
- precision
The precision of the embedding net parameters. Supported options are “default”, “bfloat16”, “float64”, “float16”, “float32”.
- uniform_seed
Only for the purpose of backward compatibility, retrieves the old behavior of using the random seed
- get_dim_rot_mat_1() int[source]#
Returns the first dimension of the rotation matrix. The rotation is of shape dim_1 x 3.
- get_nlist() tuple[deepmd.tf.env.tf.Tensor, deepmd.tf.env.tf.Tensor, list[int], list[int]][source]#
Returns neighbor information.
- Returns:
nlistNeighbor list
rijThe relative distance between the neighbor and the center atom.
sel_aThe number of neighbors with full information
sel_rThe number of neighbors with only radial information
- compute_input_stats(data_coord: list, data_box: list, data_atype: list, natoms_vec: list, mesh: list, input_dict: dict, **kwargs: Any) None[source]#
Compute the statistics (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.
- 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. Should have ‘efield’.
- 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
- class deepmd.tf.descriptor.se_a_ef.DescrptSeAEfLower(op: collections.abc.Callable, rcut: float, rcut_smth: float, sel: list[int], neuron: list[int] = [24, 48, 96], axis_neuron: int = 8, resnet_dt: bool = False, trainable: bool = True, seed: int | None = None, type_one_side: bool = True, exclude_types: list[list[int]] = [], set_davg_zero: bool = False, activation_function: str = 'tanh', precision: str = 'default', uniform_seed: bool = False)[source]#
Bases:
deepmd.tf.descriptor.se_a.DescrptSeAHelper class for implementing DescrptSeAEf.
- compute_input_stats(data_coord: list[numpy.ndarray], data_box: list[numpy.ndarray], data_atype: list[numpy.ndarray], natoms_vec: list[numpy.ndarray], mesh: list[numpy.ndarray], input_dict: dict, **kwargs: Any) None[source]#
Compute the statistics (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.
- build(coord_: deepmd.tf.env.tf.Tensor, atype_: deepmd.tf.env.tf.Tensor, natoms: list, box_: deepmd.tf.env.tf.Tensor, mesh: deepmd.tf.env.tf.Tensor, input_dict: dict, suffix: str = '', reuse: bool | None = None) 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
- _compute_dstats_sys_smth(data_coord: numpy.ndarray, data_box: numpy.ndarray, data_atype: numpy.ndarray, natoms_vec: numpy.ndarray, mesh: numpy.ndarray, data_efield: numpy.ndarray) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray][source]#
- property input_requirement: list[deepmd.utils.data.DataRequirementItem][source]#
Return data requirements needed for the model input.