deepmd.tf.infer.deep_tensor
Module Contents
Classes
Evaluates a tensor model. |
- class deepmd.tf.infer.deep_tensor.DeepTensor(model_file: pathlib.Path, load_prefix: str = 'load', default_tf_graph: bool = False, input_map: dict | None = None, neighbor_list=None)[source]
Bases:
deepmd.tf.infer.deep_eval.DeepEvalOld
Evaluates a tensor model.
- Parameters:
- model_file: str
The name of the frozen model file.
- load_prefix: str
The prefix in the load computational graph
- default_tf_graphbool
If uses the default tf graph, otherwise build a new tf graph for evaluation
- input_map
dict
,optional
The input map for tf.import_graph_def. Only work with default tf graph
- neighbor_list
ase.neighborlist.NeighborList
,optional
The neighbor list object. If None, then build the native neighbor list.
- eval(coords: numpy.ndarray, cells: numpy.ndarray, atom_types: List[int], atomic: bool = True, fparam: numpy.ndarray | None = None, aparam: numpy.ndarray | None = None, efield: numpy.ndarray | None = None, mixed_type: bool = False) numpy.ndarray [source]
Evaluate the model.
- Parameters:
- coords
The coordinates of atoms. The array should be of size nframes x natoms x 3
- cells
The cell of the region. If None then non-PBC is assumed, otherwise using PBC. The array should be of size nframes x 9
- atom_types
The atom types The list should contain natoms ints
- atomic
If True (default), return the atomic tensor Otherwise return the global tensor
- fparam
Not used in this model
- aparam
Not used in this model
- efield
Not used in this model
- mixed_type
Whether to perform the mixed_type mode. If True, the input data has the mixed_type format (see doc/model/train_se_atten.md), in which frames in a system may have different natoms_vec(s), with the same nloc.
- Returns:
tensor
The returned tensor If atomic == False then of size nframes x output_dim else of size nframes x natoms x output_dim
- eval_full(coords: numpy.ndarray, cells: numpy.ndarray, atom_types: List[int], atomic: bool = False, fparam: numpy.array | None = None, aparam: numpy.array | None = None, efield: numpy.array | None = None, mixed_type: bool = False) Tuple[numpy.ndarray, Ellipsis] [source]
Evaluate the model with interface similar to the energy model. Will return global tensor, component-wise force and virial and optionally atomic tensor and atomic virial.
- Parameters:
- coords
The coordinates of atoms. The array should be of size nframes x natoms x 3
- cells
The cell of the region. If None then non-PBC is assumed, otherwise using PBC. The array should be of size nframes x 9
- atom_types
The atom types The list should contain natoms ints
- atomic
Whether to calculate atomic tensor and virial
- fparam
Not used in this model
- aparam
Not used in this model
- efield
Not used in this model
- mixed_type
Whether to perform the mixed_type mode. If True, the input data has the mixed_type format (see doc/model/train_se_atten.md), in which frames in a system may have different natoms_vec(s), with the same nloc.
- Returns:
tensor
The global tensor. shape: [nframes x nout]
force
The component-wise force (negative derivative) on each atom. shape: [nframes x nout x natoms x 3]
virial
The component-wise virial of the tensor. shape: [nframes x nout x 9]
atom_tensor
The atomic tensor. Only returned when atomic == True shape: [nframes x natoms x nout]
atom_virial
The atomic virial. Only returned when atomic == True shape: [nframes x nout x natoms x 9]