deepmd.descriptor package
Submodules
deepmd.descriptor.descriptor module
- class deepmd.descriptor.descriptor.Descriptor[source]
Bases:
abc.ABC
The abstract class for descriptors. All specific descriptors should be based on this class.
The descriptor \(\mathcal{D}\) describes the environment of an atom, which should be a function of coordinates and types of its neighbour atoms.
Notes
Only methods and attributes defined in this class are generally public, that can be called by other classes.
Methods
build
(coord_, atype_, natoms, box_, mesh, …)Build the computational graph for the descriptor.
compute_input_stats
(data_coord, data_box, …)Compute the statisitcs (avg and std) of the training data.
enable_compression
(min_nbor_dist[, …])Reveive the statisitcs (distance, max_nbor_size and env_mat_range) of the training data.
Returns the output dimension of this descriptor.
Returns the first dimension of the rotation matrix.
get_feed_dict
(coord_, atype_, natoms, box, mesh)Generate the feed_dict for current descriptor
Returns neighbor information.
Returns the number of atom types.
get_rcut
()Returns the cut-off radius.
get_tensor_names
([suffix])Get names of tensors.
init_variables
(model_file[, suffix])Init the embedding net variables with the given dict
pass_tensors_from_frz_model
(*tensors)Pass the descrpt_reshape tensor as well as descrpt_deriv tensor from the frz graph_def
prod_force_virial
(atom_ener, natoms)Compute force and virial.
- abstract build(coord_: tensorflow.python.framework.ops.Tensor, atype_: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor, box_: tensorflow.python.framework.ops.Tensor, mesh: tensorflow.python.framework.ops.Tensor, input_dict: Dict[str, Any], reuse: Optional[bool] = None, suffix: str = '') → tensorflow.python.framework.ops.Tensor[source]
Build the computational graph for the descriptor.
- Parameters
- coord_
tf.Tensor
The coordinate of atoms
- atype_
tf.Tensor
The type of atoms
- natoms
tf.Tensor
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 frames
- mesh
tf.Tensor
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
dict
[str
,Any
] Dictionary for additional inputs
- reusebool,
optional
The weights in the networks should be reused when get the variable.
- suffix
str
,optional
Name suffix to identify this descriptor
- coord_
- Returns
- descriptor:
tf.Tensor
The output descriptor
- descriptor:
Notes
This method must be implemented, as it’s called by other classes.
- abstract 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[str, List[numpy.ndarray]]) → None[source]
Compute the statisitcs (avg and std) of the training data. The input will be normalized by the statistics.
- Parameters
- data_coord
list
[np.ndarray
] The coordinates. Can be generated by
deepmd.model.model_stat.make_stat_input()
- data_box
list
[np.ndarray
] The box. Can be generated by
deepmd.model.model_stat.make_stat_input()
- data_atype
list
[np.ndarray
] The atom types. Can be generated by
deepmd.model.model_stat.make_stat_input()
- natoms_vec
list
[np.ndarray
] The vector for the number of atoms of the system and different types of atoms. Can be generated by
deepmd.model.model_stat.make_stat_input()
- mesh
list
[np.ndarray
] The mesh for neighbor searching. Can be generated by
deepmd.model.model_stat.make_stat_input()
- input_dict
dict
[str
,list
[np.ndarray
]] Dictionary for additional input
- data_coord
Notes
This method must be implemented, as it’s called by other classes.
- enable_compression(min_nbor_dist: float, model_file: str = 'frozon_model.pb', table_extrapolate: float = 5.0, table_stride_1: float = 0.01, table_stride_2: float = 0.1, check_frequency: int = - 1, suffix: str = '') → None[source]
Reveive the statisitcs (distance, max_nbor_size and env_mat_range) of the training data.
- Parameters
- min_nbor_dist
float
The nearest distance between atoms
- model_file
str
, default: ‘frozon_model.pb’ The original frozen model, which will be compressed by the program
- table_extrapolate
float
, default: 5. The scale of model extrapolation
- table_stride_1
float
, default: 0.01 The uniform stride of the first table
- table_stride_2
float
, default: 0.1 The uniform stride of the second table
- check_frequency
int
, default: -1 The overflow check frequency
- suffix
str
,optional
The suffix of the scope
- min_nbor_dist
Notes
This method is called by others when the descriptor supported compression.
- abstract get_dim_out() → int[source]
Returns the output dimension of this descriptor.
- Returns
int
the output dimension of this descriptor
Notes
This method must be implemented, as it’s called by other classes.
- get_dim_rot_mat_1() → int[source]
Returns the first dimension of the rotation matrix. The rotation is of shape dim_1 x 3
- Returns
int
the first dimension of the rotation matrix
- get_feed_dict(coord_: tensorflow.python.framework.ops.Tensor, atype_: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor, box: tensorflow.python.framework.ops.Tensor, mesh: tensorflow.python.framework.ops.Tensor) → Dict[str, tensorflow.python.framework.ops.Tensor][source]
Generate the feed_dict for current descriptor
- Parameters
- coord_
tf.Tensor
The coordinate of atoms
- atype_
tf.Tensor
The type of atoms
- natoms
tf.Tensor
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. Can be generated by deepmd.model.make_stat_input
- mesh
tf.Tensor
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.
- coord_
- Returns
- get_nlist() → Tuple[tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor, List[int], List[int]][source]
Returns neighbor information.
- abstract get_ntypes() → int[source]
Returns the number of atom types.
- Returns
int
the number of atom types
Notes
This method must be implemented, as it’s called by other classes.
- abstract get_rcut() → float[source]
Returns the cut-off radius.
- Returns
float
the cut-off radius
Notes
This method must be implemented, as it’s called by other classes.
- init_variables(model_file: str, suffix: str = '') → None[source]
Init the embedding net variables with the given dict
Notes
This method is called by others when the descriptor supported initialization from the given variables.
- pass_tensors_from_frz_model(*tensors: tensorflow.python.framework.ops.Tensor) → None[source]
Pass the descrpt_reshape tensor as well as descrpt_deriv tensor from the frz graph_def
- Parameters
- *tensors
tf.Tensor
passed tensors
- *tensors
Notes
The number of parameters in the method must be equal to the numbers of returns in
get_tensor_names()
.
- abstract prod_force_virial(atom_ener: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor) → Tuple[tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor][source]
Compute force and virial.
- Parameters
- Returns
deepmd.descriptor.hybrid module
- class deepmd.descriptor.hybrid.DescrptHybrid(descrpt_list: list)[source]
Bases:
deepmd.descriptor.descriptor.Descriptor
Concate a list of descriptors to form a new descriptor.
- Parameters
- descrpt_list
list
Build a descriptor from the concatenation of the list of descriptors.
- descrpt_list
Methods
build
(coord_, atype_, natoms, box_, mesh, …)Build the computational graph for the descriptor
compute_input_stats
(data_coord, data_box, …)Compute the statisitcs (avg and std) of the training data.
enable_compression
(min_nbor_dist[, …])Reveive the statisitcs (distance, max_nbor_size and env_mat_range) of the training data.
Returns the output dimension of this descriptor
get_dim_rot_mat_1
()Returns the first dimension of the rotation matrix.
get_feed_dict
(coord_, atype_, natoms, box, mesh)Generate the feed_dict for current descriptor
get_nlist
()Returns neighbor information.
get_nlist_i
(ii)Get the neighbor information of the ii-th descriptor
Returns the number of atom types
get_rcut
()Returns the cut-off radius
get_tensor_names
([suffix])Get names of tensors.
init_variables
(model_file[, suffix])Init the embedding net variables with the given dict
pass_tensors_from_frz_model
(*tensors)Pass the descrpt_reshape tensor as well as descrpt_deriv tensor from the frz graph_def
prod_force_virial
(atom_ener, natoms)Compute force and virial
- build(coord_: tensorflow.python.framework.ops.Tensor, atype_: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor, box_: tensorflow.python.framework.ops.Tensor, mesh: tensorflow.python.framework.ops.Tensor, input_dict: dict, reuse: Optional[bool] = None, suffix: str = '') → tensorflow.python.framework.ops.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
- 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
descriptor
The output descriptor
- compute_input_stats(data_coord: list, data_box: list, data_atype: list, natoms_vec: list, mesh: list, input_dict: dict) → 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.model.make_stat_input
- data_box
The box. Can be generated by deepmd.model.make_stat_input
- data_atype
The atom types. Can be generated by deepmd.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.model.make_stat_input
- mesh
The mesh for neighbor searching. Can be generated by deepmd.model.make_stat_input
- input_dict
Dictionary for additional input
- enable_compression(min_nbor_dist: float, model_file: str = 'frozon_model.pb', table_extrapolate: float = 5.0, table_stride_1: float = 0.01, table_stride_2: float = 0.1, check_frequency: int = - 1, suffix: str = '') → None[source]
Reveive the statisitcs (distance, max_nbor_size and env_mat_range) of the training data.
- Parameters
- min_nbor_dist
float
The nearest distance between atoms
- model_file
str
, default: ‘frozon_model.pb’ The original frozen model, which will be compressed by the program
- table_extrapolate
float
, default: 5. The scale of model extrapolation
- table_stride_1
float
, default: 0.01 The uniform stride of the first table
- table_stride_2
float
, default: 0.1 The uniform stride of the second table
- check_frequency
int
, default: -1 The overflow check frequency
- suffix
str
,optional
The suffix of the scope
- min_nbor_dist
- get_nlist_i(ii: int) → Tuple[tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor, List[int], List[int]][source]
Get the neighbor information of the ii-th descriptor
- Parameters
- ii
int
The index of the descriptor
- ii
- Returns
nlist
Neighbor list
rij
The relative distance between the neighbor and the center atom.
sel_a
The number of neighbors with full information
sel_r
The number of neighbors with only radial information
- init_variables(model_file: str, suffix: str = '') → None[source]
Init the embedding net variables with the given dict
- pass_tensors_from_frz_model(*tensors: tensorflow.python.framework.ops.Tensor) → None[source]
Pass the descrpt_reshape tensor as well as descrpt_deriv tensor from the frz graph_def
- Parameters
- *tensors
tf.Tensor
passed tensors
- *tensors
- prod_force_virial(atom_ener: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor) → Tuple[tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.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
force
The force on atoms
virial
The total virial
atom_virial
The atomic virial
deepmd.descriptor.loc_frame module
- class deepmd.descriptor.loc_frame.DescrptLocFrame(rcut: float, sel_a: List[int], sel_r: List[int], axis_rule: List[int])[source]
Bases:
deepmd.descriptor.descriptor.Descriptor
Defines a local frame at each atom, and the compute the descriptor as local coordinates under this frame.
- Parameters
- rcut
The cut-off radius
- sel_a
list
[str
] The length of the list should be the same as the number of atom types in the system. sel_a[i] gives the selected number of type-i neighbors. The full relative coordinates of the neighbors are used by the descriptor.
- sel_r
list
[str
] The length of the list should be the same as the number of atom types in the system. sel_r[i] gives the selected number of type-i neighbors. Only relative distance of the neighbors are used by the descriptor. sel_a[i] + sel_r[i] is recommended to be larger than the maximally possible number of type-i neighbors in the cut-off radius.
- axis_rule: list[int]
The length should be 6 times of the number of types. - axis_rule[i*6+0]: class of the atom defining the first axis of type-i atom. 0 for neighbors with full coordinates and 1 for neighbors only with relative distance.
axis_rule[i*6+1]: type of the atom defining the first axis of type-i atom.
axis_rule[i*6+2]: index of the axis atom defining the first axis. Note that the neighbors with the same class and type are sorted according to their relative distance.
axis_rule[i*6+3]: class of the atom defining the first axis of type-i atom. 0 for neighbors with full coordinates and 1 for neighbors only with relative distance.
axis_rule[i*6+4]: type of the atom defining the second axis of type-i atom.
axis_rule[i*6+5]: class of the atom defining the second axis of type-i atom. 0 for neighbors with full coordinates and 1 for neighbors only with relative distance.
Methods
build
(coord_, atype_, natoms, box_, mesh, …)Build the computational graph for the descriptor
compute_input_stats
(data_coord, data_box, …)Compute the statisitcs (avg and std) of the training data.
enable_compression
(min_nbor_dist[, …])Reveive the statisitcs (distance, max_nbor_size and env_mat_range) of the training data.
Returns the output dimension of this descriptor
get_dim_rot_mat_1
()Returns the first dimension of the rotation matrix.
get_feed_dict
(coord_, atype_, natoms, box, mesh)Generate the feed_dict for current descriptor
- Returns
Returns the number of atom types
get_rcut
()Returns the cut-off radisu
Get rotational matrix
get_tensor_names
([suffix])Get names of tensors.
init_variables
(model_file[, suffix])Init the embedding net variables with the given dict
pass_tensors_from_frz_model
(*tensors)Pass the descrpt_reshape tensor as well as descrpt_deriv tensor from the frz graph_def
prod_force_virial
(atom_ener, natoms)Compute force and virial
- build(coord_: tensorflow.python.framework.ops.Tensor, atype_: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor, box_: tensorflow.python.framework.ops.Tensor, mesh: tensorflow.python.framework.ops.Tensor, input_dict: dict, reuse: Optional[bool] = None, suffix: str = '') → tensorflow.python.framework.ops.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
- 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
descriptor
The output descriptor
- compute_input_stats(data_coord: list, data_box: list, data_atype: list, natoms_vec: list, mesh: list, input_dict: dict) → 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.model.make_stat_input
- data_box
The box. Can be generated by deepmd.model.make_stat_input
- data_atype
The atom types. Can be generated by deepmd.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.model.make_stat_input
- mesh
The mesh for neighbor searching. Can be generated by deepmd.model.make_stat_input
- input_dict
Dictionary for additional input
- get_nlist() → Tuple[tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor, List[int], List[int]][source]
- Returns
nlist
Neighbor list
rij
The relative distance between the neighbor and the center atom.
sel_a
The number of neighbors with full information
sel_r
The number of neighbors with only radial information
- prod_force_virial(atom_ener: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor) → Tuple[tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.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
force
The force on atoms
virial
The total virial
atom_virial
The atomic virial
deepmd.descriptor.se_a module
- class deepmd.descriptor.se_a.DescrptSeA[source]
Bases:
deepmd.descriptor.descriptor.Descriptor
DeepPot-SE constructed from all information (both angular and radial) of atomic configurations. The embedding takes the distance between atoms as input.
The descriptor \(\mathcal{D}^i \in \mathcal{R}^{M_1 \times M_2}\) is given by [1]
\[\mathcal{D}^i = (\mathcal{G}^i)^T \mathcal{R}^i (\mathcal{R}^i)^T \mathcal{G}^i_<\]where \(\mathcal{R}^i \in \mathbb{R}^{N \times 4}\) is the coordinate matrix, and each row of \(\mathcal{R}^i\) can be constructed as follows
\[(\mathcal{R}^i)_j = [ \begin{array}{c} s(r_{ji}) & x_{ji} & y_{ji} & z_{ji} \end{array} ]\]where \(\mathbf{R}_{ji}=\mathbf{R}_j-\mathbf{R}_i = (x_{ji}, y_{ji}, z_{ji})\) is the relative coordinate and \(r_{ji}=\lVert \mathbf{R}_{ji} \lVert\) is its norm. The switching function \(s(r)\) is defined as:
\[\begin{split}s(r)= \begin{cases} \frac{1}{r}, & r<r_s \\ \frac{1}{r} \{ {(\frac{r - r_s}{ r_c - r_s})}^3 (-6 {(\frac{r - r_s}{ r_c - r_s})}^2 +15 \frac{r - r_s}{ r_c - r_s} -10) +1 \}, & r_s \leq r<r_c \\ 0, & r \geq r_c \end{cases}\end{split}\]Each row of the embedding matrix \(\mathcal{G}^i \in \mathbb{R}^{N \times M_1}\) consists of outputs of a embedding network \(\mathcal{N}\) of \(s(r_{ji})\):
\[(\mathcal{G}^i)_j = \mathcal{N}(s(r_{ji}))\]\(\mathcal{G}^i_< \in \mathbb{R}^{N \times M_2}\) takes first \(M_2\) columns of \(\mathcal{G}^i\). The equation of embedding network \(\mathcal{N}\) can be found at
deepmd.utils.network.embedding_net()
.- Parameters
- rcut
The cut-off radius \(r_c\)
- rcut_smth
From where the environment matrix should be smoothed \(r_s\)
- sel
list
[str
] 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 \(\mathcal{N}\)
- axis_neuron
Number of the axis neuron \(M_2\) (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 {0}
- precision
The precision of the embedding net parameters. Supported options are {1}
- uniform_seed
Only for the purpose of backward compatibility, retrieves the old behavior of using the random seed
References
- 1
Linfeng Zhang, Jiequn Han, Han Wang, Wissam A. Saidi, Roberto Car, and E. Weinan. 2018. End-to-end symmetry preserving inter-atomic potential energy model for finite and extended systems. In Proceedings of the 32nd International Conference on Neural Information Processing Systems (NIPS’18). Curran Associates Inc., Red Hook, NY, USA, 4441–4451.
Methods
build
(coord_, atype_, natoms, box_, mesh, …)Build the computational graph for the descriptor
compute_input_stats
(data_coord, data_box, …)Compute the statisitcs (avg and std) of the training data.
enable_compression
(min_nbor_dist[, …])Reveive the statisitcs (distance, max_nbor_size and env_mat_range) of the training data.
Returns the output dimension of this descriptor
Returns the first dimension of the rotation matrix.
get_feed_dict
(coord_, atype_, natoms, box, mesh)Generate the feed_dict for current descriptor
- Returns
Returns the number of atom types
get_rcut
()Returns the cut-off radius
Get rotational matrix
get_tensor_names
([suffix])Get names of tensors.
init_variables
(model_file[, suffix])Init the embedding net variables with the given dict
pass_tensors_from_frz_model
(descrpt_reshape, …)Pass the descrpt_reshape tensor as well as descrpt_deriv tensor from the frz graph_def
prod_force_virial
(atom_ener, natoms)Compute force and virial
- build(coord_: tensorflow.python.framework.ops.Tensor, atype_: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor, box_: tensorflow.python.framework.ops.Tensor, mesh: tensorflow.python.framework.ops.Tensor, input_dict: dict, reuse: Optional[bool] = None, suffix: str = '') → tensorflow.python.framework.ops.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
- 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
descriptor
The output descriptor
- compute_input_stats(data_coord: list, data_box: list, data_atype: list, natoms_vec: list, mesh: list, input_dict: dict) → 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.model.make_stat_input
- data_box
The box. Can be generated by deepmd.model.make_stat_input
- data_atype
The atom types. Can be generated by deepmd.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.model.make_stat_input
- mesh
The mesh for neighbor searching. Can be generated by deepmd.model.make_stat_input
- input_dict
Dictionary for additional input
- enable_compression(min_nbor_dist: float, model_file: str = 'frozon_model.pb', table_extrapolate: float = 5, table_stride_1: float = 0.01, table_stride_2: float = 0.1, check_frequency: int = - 1, suffix: str = '') → None[source]
Reveive the statisitcs (distance, max_nbor_size and env_mat_range) of the training data.
- Parameters
- min_nbor_dist
The nearest distance between atoms
- model_file
The original frozen model, which will be compressed by the program
- 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
- 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[tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor, List[int], List[int]][source]
- Returns
nlist
Neighbor list
rij
The relative distance between the neighbor and the center atom.
sel_a
The number of neighbors with full information
sel_r
The number of neighbors with only radial information
- init_variables(model_file: str, suffix: str = '') → None[source]
Init the embedding net variables with the given dict
- pass_tensors_from_frz_model(descrpt_reshape: tensorflow.python.framework.ops.Tensor, descrpt_deriv: tensorflow.python.framework.ops.Tensor, rij: tensorflow.python.framework.ops.Tensor, nlist: tensorflow.python.framework.ops.Tensor)[source]
Pass the descrpt_reshape tensor as well as descrpt_deriv tensor from the frz graph_def
- Parameters
- descrpt_reshape
The passed descrpt_reshape tensor
- descrpt_deriv
The passed descrpt_deriv tensor
- rij
The passed rij tensor
- nlist
The passed nlist tensor
- prod_force_virial(atom_ener: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor) → Tuple[tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.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
force
The force on atoms
virial
The total virial
atom_virial
The atomic virial
deepmd.descriptor.se_a_ebd module
- class deepmd.descriptor.se_a_ebd.DescrptSeAEbd(rcut: float, rcut_smth: float, sel: List[str], neuron: List[int] = [24, 48, 96], axis_neuron: int = 8, resnet_dt: bool = False, trainable: bool = True, seed: Optional[int] = None, type_one_side: bool = True, type_nchanl: int = 2, type_nlayer: int = 1, numb_aparam: int = 0, set_davg_zero: bool = False, activation_function: str = 'tanh', precision: str = 'default', exclude_types: List[List[int]] = [])[source]
Bases:
deepmd.descriptor.se_a.DescrptSeA
DeepPot-SE descriptor with type embedding approach.
- Parameters
- rcut
The cut-off radius
- rcut_smth
From where the environment matrix should be smoothed
- sel
list
[str
] 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
- type_nchanl
Number of channels for type representation
- type_nlayer
Number of hidden layers for the type embedding net (skip connected).
- numb_aparam
Number of atomic parameters. If >0 it will be embedded with atom types.
- set_davg_zero
Set the shift of embedding net input to zero.
- activation_function
The activation function in the embedding net. Supported options are {0}
- precision
The precision of the embedding net parameters. Supported options are {1}
- 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.
Methods
build
(coord_, atype_, natoms, box_, mesh, …)Build the computational graph for the descriptor
compute_input_stats
(data_coord, data_box, …)Compute the statisitcs (avg and std) of the training data.
enable_compression
(min_nbor_dist[, …])Reveive the statisitcs (distance, max_nbor_size and env_mat_range) of the training data.
get_dim_out
()Returns the output dimension of this descriptor
get_dim_rot_mat_1
()Returns the first dimension of the rotation matrix.
get_feed_dict
(coord_, atype_, natoms, box, mesh)Generate the feed_dict for current descriptor
get_nlist
()- Returns
get_ntypes
()Returns the number of atom types
get_rcut
()Returns the cut-off radius
get_rot_mat
()Get rotational matrix
get_tensor_names
([suffix])Get names of tensors.
init_variables
(model_file[, suffix])Init the embedding net variables with the given dict
pass_tensors_from_frz_model
(descrpt_reshape, …)Pass the descrpt_reshape tensor as well as descrpt_deriv tensor from the frz graph_def
prod_force_virial
(atom_ener, natoms)Compute force and virial
- build(coord_: tensorflow.python.framework.ops.Tensor, atype_: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor, box_: tensorflow.python.framework.ops.Tensor, mesh: tensorflow.python.framework.ops.Tensor, input_dict: dict, reuse: Optional[bool] = None, suffix: str = '') → tensorflow.python.framework.ops.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
- 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
descriptor
The output descriptor
deepmd.descriptor.se_a_ef module
- class deepmd.descriptor.se_a_ef.DescrptSeAEf[source]
Bases:
deepmd.descriptor.descriptor.Descriptor
- Parameters
- rcut
The cut-off radius
- rcut_smth
From where the environment matrix should be smoothed
- sel
list
[str
] 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 {0}
- precision
The precision of the embedding net parameters. Supported options are {1}
- uniform_seed
Only for the purpose of backward compatibility, retrieves the old behavior of using the random seed
Methods
build
(coord_, atype_, natoms, box_, mesh, …)Build the computational graph for the descriptor
compute_input_stats
(data_coord, data_box, …)Compute the statisitcs (avg and std) of the training data.
enable_compression
(min_nbor_dist[, …])Reveive the statisitcs (distance, max_nbor_size and env_mat_range) of the training data.
Returns the output dimension of this descriptor
Returns the first dimension of the rotation matrix.
get_feed_dict
(coord_, atype_, natoms, box, mesh)Generate the feed_dict for current descriptor
- Returns
Returns the number of atom types
get_rcut
()Returns the cut-off radisu
Get rotational matrix
get_tensor_names
([suffix])Get names of tensors.
init_variables
(model_file[, suffix])Init the embedding net variables with the given dict
pass_tensors_from_frz_model
(*tensors)Pass the descrpt_reshape tensor as well as descrpt_deriv tensor from the frz graph_def
prod_force_virial
(atom_ener, natoms)Compute force and virial
- build(coord_: tensorflow.python.framework.ops.Tensor, atype_: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor, box_: tensorflow.python.framework.ops.Tensor, mesh: tensorflow.python.framework.ops.Tensor, input_dict: dict, reuse: Optional[bool] = None, suffix: str = '') → tensorflow.python.framework.ops.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
- 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
descriptor
The output descriptor
- compute_input_stats(data_coord: list, data_box: list, data_atype: list, natoms_vec: list, mesh: list, input_dict: dict) → 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.model.make_stat_input
- data_box
The box. Can be generated by deepmd.model.make_stat_input
- data_atype
The atom types. Can be generated by deepmd.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.model.make_stat_input
- mesh
The mesh for neighbor searching. Can be generated by deepmd.model.make_stat_input
- input_dict
Dictionary for additional input
- 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[tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor, List[int], List[int]][source]
- Returns
nlist
Neighbor list
rij
The relative distance between the neighbor and the center atom.
sel_a
The number of neighbors with full information
sel_r
The number of neighbors with only radial information
- prod_force_virial(atom_ener: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor) → Tuple[tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.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
force
The force on atoms
virial
The total virial
atom_virial
The atomic virial
- class deepmd.descriptor.se_a_ef.DescrptSeAEfLower(op, rcut: float, rcut_smth: float, sel: List[str], neuron: List[int] = [24, 48, 96], axis_neuron: int = 8, resnet_dt: bool = False, trainable: bool = True, seed: Optional[int] = 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.descriptor.se_a.DescrptSeA
Helper class for implementing DescrptSeAEf
Methods
build
(coord_, atype_, natoms, box_, mesh, …)Build the computational graph for the descriptor
compute_input_stats
(data_coord, data_box, …)Compute the statisitcs (avg and std) of the training data.
enable_compression
(min_nbor_dist[, …])Reveive the statisitcs (distance, max_nbor_size and env_mat_range) of the training data.
get_dim_out
()Returns the output dimension of this descriptor
get_dim_rot_mat_1
()Returns the first dimension of the rotation matrix.
get_feed_dict
(coord_, atype_, natoms, box, mesh)Generate the feed_dict for current descriptor
get_nlist
()- Returns
get_ntypes
()Returns the number of atom types
get_rcut
()Returns the cut-off radius
get_rot_mat
()Get rotational matrix
get_tensor_names
([suffix])Get names of tensors.
init_variables
(model_file[, suffix])Init the embedding net variables with the given dict
pass_tensors_from_frz_model
(descrpt_reshape, …)Pass the descrpt_reshape tensor as well as descrpt_deriv tensor from the frz graph_def
prod_force_virial
(atom_ener, natoms)Compute force and virial
- build(coord_, atype_, natoms, box_, mesh, input_dict, suffix='', reuse=None)[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
- 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
descriptor
The output descriptor
- compute_input_stats(data_coord, data_box, data_atype, natoms_vec, mesh, input_dict)[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.model.make_stat_input
- data_box
The box. Can be generated by deepmd.model.make_stat_input
- data_atype
The atom types. Can be generated by deepmd.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.model.make_stat_input
- mesh
The mesh for neighbor searching. Can be generated by deepmd.model.make_stat_input
- input_dict
Dictionary for additional input
deepmd.descriptor.se_ar module
- class deepmd.descriptor.se_ar.DescrptSeAR(jdata)[source]
Bases:
deepmd.descriptor.descriptor.Descriptor
Methods
build
(coord_, atype_, natoms, box, mesh, …)Build the computational graph for the descriptor.
compute_input_stats
(data_coord, data_box, …)Compute the statisitcs (avg and std) of the training data.
enable_compression
(min_nbor_dist[, …])Reveive the statisitcs (distance, max_nbor_size and env_mat_range) of the training data.
Returns the output dimension of this descriptor.
get_dim_rot_mat_1
()Returns the first dimension of the rotation matrix.
get_feed_dict
(coord_, atype_, natoms, box, mesh)Generate the feed_dict for current descriptor
get_nlist
()Returns neighbor information.
Returns the number of atom types.
get_rcut
()Returns the cut-off radius.
get_tensor_names
([suffix])Get names of tensors.
init_variables
(model_file[, suffix])Init the embedding net variables with the given dict
pass_tensors_from_frz_model
(*tensors)Pass the descrpt_reshape tensor as well as descrpt_deriv tensor from the frz graph_def
prod_force_virial
(atom_ener, natoms)Compute force and virial.
get_nlist_a
get_nlist_r
- build(coord_, atype_, natoms, box, mesh, input_dict, suffix='', reuse=None)[source]
Build the computational graph for the descriptor.
- Parameters
- coord_
tf.Tensor
The coordinate of atoms
- atype_
tf.Tensor
The type of atoms
- natoms
tf.Tensor
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 frames
- mesh
tf.Tensor
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
dict
[str
,Any
] Dictionary for additional inputs
- reusebool,
optional
The weights in the networks should be reused when get the variable.
- suffix
str
,optional
Name suffix to identify this descriptor
- coord_
- Returns
- descriptor:
tf.Tensor
The output descriptor
- descriptor:
Notes
This method must be implemented, as it’s called by other classes.
- compute_input_stats(data_coord, data_box, data_atype, natoms_vec, mesh, input_dict)[source]
Compute the statisitcs (avg and std) of the training data. The input will be normalized by the statistics.
- Parameters
- data_coord
list
[np.ndarray
] The coordinates. Can be generated by
deepmd.model.model_stat.make_stat_input()
- data_box
list
[np.ndarray
] The box. Can be generated by
deepmd.model.model_stat.make_stat_input()
- data_atype
list
[np.ndarray
] The atom types. Can be generated by
deepmd.model.model_stat.make_stat_input()
- natoms_vec
list
[np.ndarray
] The vector for the number of atoms of the system and different types of atoms. Can be generated by
deepmd.model.model_stat.make_stat_input()
- mesh
list
[np.ndarray
] The mesh for neighbor searching. Can be generated by
deepmd.model.model_stat.make_stat_input()
- input_dict
dict
[str
,list
[np.ndarray
]] Dictionary for additional input
- data_coord
Notes
This method must be implemented, as it’s called by other classes.
- get_dim_out()[source]
Returns the output dimension of this descriptor.
- Returns
int
the output dimension of this descriptor
Notes
This method must be implemented, as it’s called by other classes.
- get_ntypes()[source]
Returns the number of atom types.
- Returns
int
the number of atom types
Notes
This method must be implemented, as it’s called by other classes.
- get_rcut()[source]
Returns the cut-off radius.
- Returns
float
the cut-off radius
Notes
This method must be implemented, as it’s called by other classes.
deepmd.descriptor.se_r module
- class deepmd.descriptor.se_r.DescrptSeR[source]
Bases:
deepmd.descriptor.descriptor.Descriptor
DeepPot-SE constructed from radial information of atomic configurations.
The embedding takes the distance between atoms as input.
- Parameters
- rcut
The cut-off radius
- rcut_smth
From where the environment matrix should be smoothed
- sel
list
[str
] 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.
- 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.
- activation_function
The activation function in the embedding net. Supported options are {0}
- precision
The precision of the embedding net parameters. Supported options are {1}
- uniform_seed
Only for the purpose of backward compatibility, retrieves the old behavior of using the random seed
Methods
build
(coord_, atype_, natoms, box_, mesh, …)Build the computational graph for the descriptor
compute_input_stats
(data_coord, data_box, …)Compute the statisitcs (avg and std) of the training data.
enable_compression
(min_nbor_dist[, …])Reveive the statisitcs (distance, max_nbor_size and env_mat_range) of the training data.
Returns the output dimension of this descriptor
get_dim_rot_mat_1
()Returns the first dimension of the rotation matrix.
get_feed_dict
(coord_, atype_, natoms, box, mesh)Generate the feed_dict for current descriptor
- Returns
Returns the number of atom types
get_rcut
()Returns the cut-off radisu
get_tensor_names
([suffix])Get names of tensors.
init_variables
(model_file[, suffix])Init the embedding net variables with the given dict
pass_tensors_from_frz_model
(*tensors)Pass the descrpt_reshape tensor as well as descrpt_deriv tensor from the frz graph_def
prod_force_virial
(atom_ener, natoms)Compute force and virial
- build(coord_: tensorflow.python.framework.ops.Tensor, atype_: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor, box_: tensorflow.python.framework.ops.Tensor, mesh: tensorflow.python.framework.ops.Tensor, input_dict: dict, reuse: Optional[bool] = None, suffix: str = '') → tensorflow.python.framework.ops.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
- 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
descriptor
The output descriptor
- compute_input_stats(data_coord, data_box, data_atype, natoms_vec, mesh, input_dict)[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.model.make_stat_input
- data_box
The box. Can be generated by deepmd.model.make_stat_input
- data_atype
The atom types. Can be generated by deepmd.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.model.make_stat_input
- mesh
The mesh for neighbor searching. Can be generated by deepmd.model.make_stat_input
- input_dict
Dictionary for additional input
- get_nlist()[source]
- Returns
nlist
Neighbor list
rij
The relative distance between the neighbor and the center atom.
sel_a
The number of neighbors with full information
sel_r
The number of neighbors with only radial information
- prod_force_virial(atom_ener: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor) → Tuple[tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.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
force
The force on atoms
virial
The total virial
atom_virial
The atomic virial
deepmd.descriptor.se_t module
- class deepmd.descriptor.se_t.DescrptSeT[source]
Bases:
deepmd.descriptor.descriptor.Descriptor
DeepPot-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
[str
] 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 {0}
- precision
The precision of the embedding net parameters. Supported options are {1}
- uniform_seed
Only for the purpose of backward compatibility, retrieves the old behavior of using the random seed
Methods
build
(coord_, atype_, natoms, box_, mesh, …)Build the computational graph for the descriptor
compute_input_stats
(data_coord, data_box, …)Compute the statisitcs (avg and std) of the training data.
enable_compression
(min_nbor_dist[, …])Reveive the statisitcs (distance, max_nbor_size and env_mat_range) of the training data.
Returns the output dimension of this descriptor
get_dim_rot_mat_1
()Returns the first dimension of the rotation matrix.
get_feed_dict
(coord_, atype_, natoms, box, mesh)Generate the feed_dict for current descriptor
- Returns
Returns the number of atom types
get_rcut
()Returns the cut-off radisu
get_tensor_names
([suffix])Get names of tensors.
init_variables
(model_file[, suffix])Init the embedding net variables with the given dict
pass_tensors_from_frz_model
(*tensors)Pass the descrpt_reshape tensor as well as descrpt_deriv tensor from the frz graph_def
prod_force_virial
(atom_ener, natoms)Compute force and virial
- build(coord_: tensorflow.python.framework.ops.Tensor, atype_: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor, box_: tensorflow.python.framework.ops.Tensor, mesh: tensorflow.python.framework.ops.Tensor, input_dict: dict, reuse: Optional[bool] = None, suffix: str = '') → tensorflow.python.framework.ops.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
- 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
descriptor
The output descriptor
- compute_input_stats(data_coord: list, data_box: list, data_atype: list, natoms_vec: list, mesh: list, input_dict: dict) → 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.model.make_stat_input
- data_box
The box. Can be generated by deepmd.model.make_stat_input
- data_atype
The atom types. Can be generated by deepmd.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.model.make_stat_input
- mesh
The mesh for neighbor searching. Can be generated by deepmd.model.make_stat_input
- input_dict
Dictionary for additional input
- get_nlist() → Tuple[tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor, List[int], List[int]][source]
- Returns
nlist
Neighbor list
rij
The relative distance between the neighbor and the center atom.
sel_a
The number of neighbors with full information
sel_r
The number of neighbors with only radial information
- prod_force_virial(atom_ener: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor) → Tuple[tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.Tensor, tensorflow.python.framework.ops.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
force
The force on atoms
virial
The total virial
atom_virial
The atomic virial