deepmd.tf.utils.neighbor_stat

Module Contents

Classes

NeighborStatOP

Class for getting neighbor statics data information.

NeighborStat

Class for getting training data information.

Attributes

log

deepmd.tf.utils.neighbor_stat.log[source]
class deepmd.tf.utils.neighbor_stat.NeighborStatOP(ntypes: int, rcut: float, mixed_types: bool)[source]

Class for getting neighbor statics data information.

Parameters:
ntypes

The num of atom types

rcut

The cut-off radius

mixed_typesbool, optional

If True, treat neighbors of all types as a single type.

build(coord: deepmd.tf.env.tf.Tensor, atype: deepmd.tf.env.tf.Tensor, cell: deepmd.tf.env.tf.Tensor, pbc: deepmd.tf.env.tf.Tensor) Tuple[deepmd.tf.env.tf.Tensor, deepmd.tf.env.tf.Tensor][source]

Calculate the nearest neighbor distance between atoms, maximum nbor size of atoms and the output data range of the environment matrix.

Parameters:
coord

The coordinates of atoms.

atype

The atom types.

cell

The cell.

Returns:
tf.Tensor

The minimal squared distance between two atoms, in the shape of (nframes,)

tf.Tensor

The maximal number of neighbors

class deepmd.tf.utils.neighbor_stat.NeighborStat(ntypes: int, rcut: float, mixed_type: bool = False)[source]

Bases: deepmd.utils.neighbor_stat.NeighborStat

Class for getting training data information.

It loads data from DeepmdData object, and measures the data info, including neareest nbor distance between atoms, max nbor size of atoms and the output data range of the environment matrix.

Parameters:
ntypes

The num of atom types

rcut

The cut-off radius

mixed_typebool, optional, default=False

Treat all types as a single type.

build() Tuple[deepmd.tf.env.tf.Tensor, deepmd.tf.env.tf.Tensor][source]

Build the graph.

Returns:
tf.Tensor

The minimal squared distance between two atoms, in the shape of (nframes,)

tf.Tensor

The maximal number of neighbors

iterator(data: deepmd.tf.utils.data_system.DeepmdDataSystem) Iterator[Tuple[numpy.ndarray, float, str]][source]

Produce data.

Parameters:
data

The data system

Yields:
np.ndarray

The maximal number of neighbors

float

The squared minimal distance between two atoms

str

The directory of the data system

_execute(coord: numpy.ndarray, atype: numpy.ndarray, box: numpy.ndarray | None, pbc: bool)[source]

Execute the operation.

Parameters:
coord

The coordinates of atoms.

atype

The atom types.

box

The box.

pbc

Whether the box is periodic.